【问题标题】:TYPO3: category tree of tx-news, render sub-tree only if main is selectedTYPO3:tx-news 的类别树,仅在选择 main 时才呈现子树
【发布时间】:2017-03-16 05:27:47
【问题描述】:

i override Templates/Styles/TWB/Templates/Category/List.html要具有类别菜单的行为完全作为介绍包中的侧栏菜单(仅在选中主子菜单时显示)。

如果我添加静态模板“News Styles Twitter Bootstrap(news)”就差不多了,只要选择了主类,打开子类也不难(我需要海量的类/子类别),但它也应该在选择子类别时打开:

...
    <f:if condition="{0:category.item.uid,1:category.item.uid} == {0:overwriteDemand.categories,1:category.children.{overwriteDemand.categories}.parent}">
        <f:if condition="{category.children}">
            <f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand,class:''}" />
        </f:if>
    </f:if>
...

我不知道如何使用 {overwriteDemand.categories} 作为键来匹配值...谁能指出正确的语法

更新:我尝试将自定义 ViewHelper 应用为 this post suggests,但使用 TYPO3 V7.6.16 时遇到错误 should be compatible with TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper:‌​:render(),因此无法尝试使用变量 overwriteDemand.categories换一种方式……

【问题讨论】:

    标签: typo3 fluid typo3-7.6.x tx-news


    【解决方案1】:

    从 TYPO3 8 开始就可以动态访问流体中的变量。在此处查看最新幻灯片:https://typo3.org/download/release-notes/whats-new/ 并在 PDF 中搜索“动态变量名称部分”。

    在 TYPO3 7 中,“vhs”-Extension 提供 a ViewHelper 来完成相同的工作,但在复杂的 f:if 条件中嵌套 ViewHelper 更加困难。如果可能,请尝试 TYPO3 8。如果不可能,您可以编写自己的 ViewHelper 来解决这个逻辑问题。

    【讨论】:

    • 嗨,保罗,整个网站现在都准备好了,但我仍然没有解决这个问题,V8 不是一个选项,但是我自己的 viewhelper 卡住了......你能给我指点吗...stackoverflow.com/questions/19731150/… 看起来不错,但出现错误 ...
    猜你喜欢
    • 2016-06-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-12
    相关资源
    最近更新 更多