Reputation: 454
I am creating a custom news template for tx_news which uses a Fluid Template.
I need to get the uid of the next news record in the loop.
<f:for each="{news}" as="newsItem" iteration="iterator">
<div id="{newsItem.uid}">
<a href="#{newsItem.next.uid???}">Go to next</a>
</div>
</f:for>
Upvotes: 2
Views: 632
Reputation: 5840
You could use the extension vhs
, it provides a ton of useful ViewHelpers - among them the ViewHelper v:iterator.next
. I've never used it, but from reading the documentation I'd use it like this (using the ViewHelper v:variable.set
from the same extension for a creating a local variable):
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:for each="{news}" as="newsItem" iteration="iterator">
<div id="{newsItem.uid}">
<v:variable.set name="nextNews" value="{news -> v:iterator.next(needle: newsItem)}"/>
<a href="#{nextNews.uid}">Go to next</a>
</div>
</f:for>
Upvotes: 1