【问题标题】:Typo3 DCE Container loopTypo3 DCE 容器循环
【发布时间】:2018-02-13 11:28:18
【问题描述】:

我想让这段代码更灵活。

如您所见,这是 DCE 的代码。

所以我想通过循环或类似的方式添加引号。

https://gist.github.com/DarthKeks/f5b3c9c26f05f3a8dfbf127dee9f9b64

【问题讨论】:

    标签: typo3 typo3-8.x


    【解决方案1】:

    在 DCE 中,您可以使用重复的部分。假设您使用变量 quote

    创建了一个部分

    导航

    • Iterator 可以是任何东西,这允许您循环执行类似的操作 计数或编号。我们使用迭代器来查看一个项目是否是 第一项,并添加一个活动类。

    例如:

        <ol class="carousel-indicators">
            <f:for each="{field.quote}" as="quote" iteration="iterator">
                <li data-target="#quote-carousel" data-slide-to="{iterator.cycle}" {f:if(condition: '{iterator.isFirst} == 1', then: ' class="active"')}></li>
            </f:for>
        </ol>
    

    旋转木马

    这里也适用同样的原则:

    <div class="carousel-inner" role="listbox">
    
        <f:for each="{field.quote}" as="quote" iteration="iterator">            
            <div class="item{f:if(condition: '{iterator.isFirst} == 1', then: ' active')}">
                <blockquote>
                    <f:format.html>{quote.expert}</f:format.html>
                    <small>{quote.expertName}</small>
                </blockquote>
            </div>
        </f:for>
    
    </div>
    

    【讨论】:

    • 嘿,谢谢,我自己解决了,但感谢您的解决方案。
    【解决方案2】:

    您可以简单地使用 dce-containers 您的 qoutes 现在只需添加一个 标记/字段并将您的 DCE 字段加载到该标记/字段中。只要 DCE 项目是相同的类型,它就会循环。

    【讨论】:

    • 感谢您的回答,您是否可以向我展示我的代码示例,我必须如何正确拆分它才能正常工作?
    猜你喜欢
    • 1970-01-01
    • 2019-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多