Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 在流体模板中获取下一条新闻记录?_Typo3_Fluid_Typo3 6.2.x - Fatal编程技术网

Typo3 在流体模板中获取下一条新闻记录?

Typo3 在流体模板中获取下一条新闻记录?,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>

我正在为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>

您可以使用扩展名
vhs
,它提供了大量有用的ViewHelper,其中包括ViewHelper。我从未使用过它,但通过阅读文档,我会这样使用它(使用ViewHelper
v: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>