Typo3 在流体模板中获取下一条新闻记录?
我正在为tx_新闻创建一个自定义新闻模板,该模板使用流体模板 我需要获取循环中下一条新闻记录的uidTypo3 在流体模板中获取下一条新闻记录?,typo3,fluid,typo3-6.2.x,Typo3,Fluid,Typo3 6.2.x,我正在为tx_新闻创建一个自定义新闻模板,该模板使用流体模板 我需要获取循环中下一条新闻记录的uid <f:for each="{news}" as="newsItem" iteration="iterator"> <div id="{newsItem.uid}"> <a href="#{newsItem.next.uid???}">Go to next</a> </div> </f:for>
<f:for each="{news}" as="newsItem" iteration="iterator">
<div id="{newsItem.uid}">
<a href="#{newsItem.next.uid???}">Go to next</a>
</div>
</f:for>
您可以使用扩展名
vhs
,它提供了大量有用的ViewHelper,其中包括ViewHelper。我从未使用过它,但通过阅读文档,我会这样使用它(使用ViewHelperv:variable.set
从同一扩展名创建局部变量):
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
{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>