typo3fluidtt-newstx-news

tt_news: different template depending on record pid? Or tx_news fluid "if pid of record" condition?


I am running tt_news in an older TYPO3 instance.

Now I have the situation I would like to use a different template for each list item depending on the pid where the rendered news item is found.

As there is no logic in the classic tt_news templates, and - I think - TS doesn't look at each record, that doesn't seem to be possible at all. Or is it?

Would it be possible with tx_news and a fluid template? Maybe there is a "if pid of record equals n" condition?


Solution

  • You can do this with tx_news. In the fluid template, inside the f:for, where the News items are iterated, you can check the pid.

    The partial is partials/List/Item.html and a simple

    <f:if condition="{newsItem.pid} == 123">
        <f:then></f:then>
        <f:else></f:else>
    <f:/if>
    

    will do the job.