TYPO3:计数内部流体 [英] TYPO3: Count up inside Fluid

查看:58
本文介绍了TYPO3:计数内部流体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm currently trying to build a carousel with bootstrap in the frontend.

生成幻灯片效果很好。

<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>

现在我需要用于控件的小圆点。

问题是,他们需要像这样计数:

Now I need the little dots for the controls.
The problem is, that they need to count up like this:

<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="2"></li>

使用与 f:for 相同的循环我确实生成了与 iteration 属性结合使用的幻灯片,因为它嵌套在行和列中,因此无法正常工作。

使用<$ c跟随输出$ c>< f:for each = {row.columns} as = column eration ='i'> :

Using the same f:for loop as I did to generate the slides in combination with the iteration attribute doesn't work because it's nested in row and columns.
Following output with <f:for each="{row.columns}" as="column" iteration='i'>:

<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>

幸运的是, Gallery 数组也有一个整数其中存储的图像量 {gallery.count.files} = 3

Luckily the gallery array also has an integer in which the amount of images is stored {gallery.count.files} = 3.

必须有一个

推荐答案

在TYPO3v8及更高版本:

In TYPO3v8 and above:

{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}')}

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

In TYPO3v7 and earlier you will need the VHS library and substitute f:variable for v:variable.set and {count + 1} for {count -> v:math.sum(b: 1)}.

这篇关于TYPO3:计数内部流体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆