[英]Display all categories from news item
I have a news item that has more categories. 我有一个新闻类别更多的新闻。 If I use firstCategory then I receive as output the first chosen category, but it's not what I want.
如果我使用firstCategory,那么我会收到输出作为第一个所选类别,但这不是我想要的。 I want to display all the categories that a news item has been marked as.
我想显示新闻项已标记为的所有类别。 I've tried following but there is no output
我尝试了以下操作,但没有输出
<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>
In for loop use newsItem.categories
instead of categories
. 在for循环使用
newsItem.categories
而不是categories
。 Like below. 像下面。
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.