繁体   English   中英

TYPO3流体视图辅助程序f:for的内联表示法

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM