For loop 类型3:在液体中计数

For loop 类型3:在液体中计数,for-loop,count,typo3,fluid,For Loop,Count,Typo3,Fluid,我目前正在尝试构建一个前端带有引导的旋转木马 生成幻灯片效果很好 <f:if condition="{gallery.rows}"> <f:for each="{gallery.rows}" as="row"> <f:for each="{row.columns}" as="column"> <f:if condition="{column.media}"> <d

我目前正在尝试构建一个前端带有引导的旋转木马

生成幻灯片效果很好

<f:if condition="{gallery.rows}">
    <f:for each="{gallery.rows}" as="row">
        <f:for each="{row.columns}" as="column">
            <f:if condition="{column.media}">
                <div class="item">
                    <f:media
                        file="{column.media}"
                        width="{column.dimensions.width}"
                        height="{column.dimensions.height}"
                        alt="{column.media.alternative}"
                        title="{column.media.title}"
                    />
                    <div class="carouselText">
                        <div class="container">
                            <h1>{column.media.title}</h1>
                            <f:if condition="{column.media.description}">
                            <p>
                                {column.media.description}
                                <f:if condition="{column.media.link}">
                                    <a href="" class="btn btn-xs">read more</a>
                                </f:if>
                            </p>
                            </f:if>
                        </div>
                    </div>
                </div>
            </f:if>
        </f:for>
    </f:for>
</f:if>
幸运的是,
gallery
数组还有一个整数,其中存储的图像量
{gallery.count.files}=3

对于循环或类似循环,必须有一种简单的方法来使用,即只使用整数而不使用数组,对吗?

在TYPO3v8及以上版本中:

{f:variable(name: 'count', value: 0)}
<!-- perform iteration to any depth, recursive or reverse or whatever -->
<li data-slide-to="{count}">..</li>
{f:variable(name: 'count', value: '{count + 1}')}
{f:variable(名称:'count',值:0)}

{f:variable(名称:'count',值:'{count+1}')}
在TYPO3v7和更早版本中,您需要VHS库,并将
f:variable
替换为
v:variable.set
{count+1}
替换为
{count->v:math.sum(b:1)}

刚刚注意到,对于TYPO3v7用户,tt应该是v:math.sum()。
<li data-target="#carousel" data-slide-to="0"></li>
<li data-target="#carousel" data-slide-to="1"></li>
<li data-target="#carousel" data-slide-to="0"></li>
{f:variable(name: 'count', value: 0)}
<!-- perform iteration to any depth, recursive or reverse or whatever -->
<li data-slide-to="{count}">..</li>
{f:variable(name: 'count', value: '{count + 1}')}