[英]Inline notation of TYPO3 Fluid view helper `f:for`
我想通過使用其內聯符號在TYPO3 Fluid模板中使用循環( f:for
)填充屬性值:
<div class="one two three">[...]</div>
有人知道該怎么做嗎?
同時,我找到了解決問題的方法。 要打印數組的所有項目,您可以執行類似{x -> f:for(each: {0: 'one', 1: 'two', 2: 'three'}, as: 'x')}
。 但這將導致: onetwothree
。 要修復視圖幫助程序f:if
幫助,請執行以下操作:
<div class="{f:if(condition: i.isLast, then: '{x}', else: '{x} ')
-> f:for(each: {0: 'one', 1: 'two', 2: 'three'}, as: 'x', iteration: 'i')}">
[...]
</div>
您可以進一步調整@witrin的解決方案,並完全內聯編寫ind:
{f:if(condition: i.isLast, then: '{x}', else: '{x} ') -> f:for(each: '{item.thing}', as: 'x', iteration: 'i')}
我猜您正在尋找流體中的一些“先進”陣列處理技術嗎? 看看https://fluidtypo3.org/viewhelpers/vhs/master.html 。
請找到以下內聯符號,它對您有很大幫助。
for循環的內聯符號
Original -> `<f:for each="{data.title}" as="title"> {title} </f:for>`
內聯表示法-> {title-> f:for(每個:'{data.title}',as:'title')}
日期的內聯符號
Date :-> `<f:format.date cldrFormat="MMMM y" forceLocale="{true}" localeFormatType="date">1-{calendar.month}-{calendar.year} 00:00:00</f:format.date>`
Inline Notation :-> {f:format.date(date:'1-{calendar.month}-{calendar.year} 00:00:00',cldrFormat:'MMMM y',localeFormatType: 'date', forceLocale: true)}
等等...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.