[TYPO3-mvc] Iterator + check modulo

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Mar 23 14:55:59 CET 2011


Hey,

> I`m tring to display something after checking the iterator. So I have
>
> <f:for each="{categories}" as="cat" iteration="iterator">
> <f:if condition="{iterator.index} % 4 == 0">
> display me
> </f:if>
> </f:for>
>
> but it doesn`t work. What am I missing ?

AFAIK the Fluid parser doesn't support mathematical operations and also 
not modulo etc. You either have to use a mathematical viewHelper with 
inline syntax here or use the cycle viewHelper:

<f:for each="{...}" as="...">
   <f:cycle values="{0:'', 1:'', 2:'', 3:1}" as="isLast">
     <f:if condition="{isLast} == 1">...</f:if>
   </f:cycle>
</f:for>

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list