[TYPO3-mvc] If-ViewHelper problems

Sebastian KurfŸürst sebastian at typo3.org
Sat Jul 25 09:29:06 CEST 2009


Hi Andriy,

> I found such code:
> 
> <ul>
> 	<f:for each="{users}" as="user" key="index">
> 		<li <f:if condition="{index} %
> 2">class="even"</f:if>">{user.firstName} {user.lastName}</li>
> 	</f:for>
> </ul>
> 
> does it work? As for me it doesn't :)
It should :-) However this nesting is really ugly IMHO, thus I'd rather 
split this If into If/Then/Else:

<f:if condition="{index} % 2">
   <f:then><li class="even"></f:then>
   <f:else><li></f:else>
</f:i>
{user.firstName}</li>

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list