0
votes

How can I check that a news article has a certain category? And when a news article is allocated to a certain category I want to add some additional information to the article (Detail). I tried this in Template/News/Detail.html e.g.:

//<f:for each="{categories}" as="category">
    <f:if condition="{category.title} == 'Category01'">
        <f:then>
            <h4>It worked!</h4>
        </f:then>
        <f:else>
            <h4>Didn't work!</h4>
        </f:else>
    </f:if>
//</f:for>
1

1 Answers

0
votes

What works is e.g. this:

<!-- check category -->         
<f:if condition="{newsItem.categories}">
    <f:for each="{newsItem.categories}" as="category">
        <f:if condition="{category.title} == 'Category01'">
            <f:then>
                <h4>It worked!</h4>
            </f:then>
        </f:if>                     
    </f:for>
</f:if>