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

Martin Kutschker masi-no at spam-typo3.org
Tue Jul 27 09:01:04 CEST 2010


Am 26.07.2010 13:49, schrieb Bastian Waidelich:
> Bastian Waidelich wrote:
> 
> Hi all,
> 
> FYI:
> 
>> Tomorrow I'll try to add this extended for ViewHelper to the Incubator
>> distribution, then you'll be able to use it already.
> 
> We've just extended the for ViewHelper with the iteration data (Thanks to a lot of patches from the
> community).
> So with the latest version of tx_fluid you can write:
> 
> <f:for each="{items}" as="item" iteration="itemIteration">
>     <li class="item{f:if(condition: itemIteration.isFirst, then: ' first-child')}">{item}</li>
> </f:for>

Wohooh! Great!

My only nitpicks are the names of "iteration" (correct but not striking) and "cycle" (which I think
to be a bit misleading as the loop won't restart at the beginning).

Masi


More information about the TYPO3-project-typo3v4mvc mailing list