[TYPO3-mvc] Fluid - is there a way to check if an object is the first or last object?

Franz Koch typo3.RemoveForMessage at elements-net.de
Sun Jul 18 21:11:41 CEST 2010


On 18.07.2010 18:05, Stephen Bungert wrote:
> Or am I suppossed to do this kind of thing in a custom viewhelper and
> not in the Controller?

yep - that would be the cleaner approach. In my case I created a custom 
for-Viewhelper that is creating a itterator object/array (whose name is 
based on the "as" part) which is containing all the information I need 
(isFirst, isLast, index, count, totalCount) for usage in my templates.

<c:for each="{foo}" as="bar">
	<f:if condition="{barItterator.isFirst}">Hey, I'm the first item</f:if>
	...
</c:for>

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list