Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 类型3流体阵列键增量为1_Typo3_Fluid - Fatal编程技术网

Typo3 类型3流体阵列键增量为1

Typo3 类型3流体阵列键增量为1,typo3,fluid,Typo3,Fluid,在流体模板中,我正在显示项目列表 <f:for each="{myItems}" as="myItem" key="key"> {key}. myItem.name </f:for> 但在我的例子中,我用{key}表示序列号。但它是从0开始的 0. myitem one 1. myitem two 那么,如何将键增加1以仅显示 谢谢。您可以使用iteration=“属性,然后使用循环。它从1开始,而不是从0开始 <f:for each="{myItems}

在流体模板中,我正在显示项目列表

<f:for each="{myItems}" as="myItem" key="key">
   {key}. myItem.name
</f:for>
但在我的例子中,我用{key}表示序列号。但它是从0开始的

0. myitem one
1. myitem two
那么,如何将键增加1以仅显示


谢谢。

您可以使用
iteration=“
属性,然后使用
循环。它从1开始,而不是从0开始

<f:for each="{myItems}" as="myItem" iteration="itemIterator">
   {itemIterator.cycle}. myItem.name
</f:for>

{itemIterator.cycle}。myItem.name
提示:
f:for
迭代器包含其他有用的属性,如
isFirst
isOdd


在流体独立和类型3V8及以上车型中:

<f:for each="{myItems}" as="myItem" key="key">
   {key + 1}. myItem.name
</f:for>

{key+1}。myItem.name

关键(不是双关语)是MathExpressionNode,任何有意禁用此实现的Fluid实现都不支持此表达式-在这种情况下,
iterator.cycle
是您的朋友。

感谢您的扩展。这里的链接非常有用。非常好!非常感谢你。
<f:for each="{myItems}" as="myItem" key="key">
   {key + 1}. myItem.name
</f:for>