【问题标题】:Display all categories from news item显示新闻项目中的所有类别
【发布时间】:2018-05-11 03:31:27
【问题描述】:

我有一个包含更多类别的新闻。如果我使用 firstCategory,那么我会收到第一个选择的类别作为输出,但这不是我想要的。我想显示新闻项目已标记为的所有类别。我试过了,但没有输出

<f:if condition=“{newsItem.categories}“>
    <span class=“news-list-category label label-default test”>
       <f:for each=“{categories}” as=“category”>
               {category.title}
       </f:for>
    </span>
</f:if>

【问题讨论】:

  • 你能用&lt;f:for each=“{newsItem.categories}” as=“category”&gt;再试一次吗?
  • 谢谢,成功了!

标签: typo3 typo3-7.6.x typo3-extensions tt-news


【解决方案1】:

在 for 循环中使用 newsItem.categories 而不是 categories。如下所示。

<f:if condition=“{newsItem.categories}“>
    <span class=“news-list-category label label-default test”>
       <f:for each=“{newsItem.categories}” as=“category”>
               {category.title}
       </f:for>
    </span>
</f:if>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-09
    • 2012-04-08
    • 2012-06-23
    • 1970-01-01
    • 2012-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多