C covort New member Aug 22, 2012 #1 Is there a way of me finding out which cycle of the loop i am currently on. For example: Code: <xen:foreach loop="$RecentNews" value="$news"> <div class="{xen:if '{$loop.cyclenumber} % 2 == 1', 'primaryContentDark', 'primaryContent'}"> </xen:foreach>
Is there a way of me finding out which cycle of the loop i am currently on. For example: Code: <xen:foreach loop="$RecentNews" value="$news"> <div class="{xen:if '{$loop.cyclenumber} % 2 == 1', 'primaryContentDark', 'primaryContent'}"> </xen:foreach>
Jake Bunce Well-known member Aug 22, 2012 #2 Rich (BB code): <xen:foreach loop="$RecentNews" value="$news" i="$i" count="$count"> <div class="{xen:if '{$loop.cyclenumber} % 2 == 1', 'primaryContentDark', 'primaryContent'}"> </xen:foreach> Now {$i} will increment for each iteration. {$count} will just have the total number of array elements.
Rich (BB code): <xen:foreach loop="$RecentNews" value="$news" i="$i" count="$count"> <div class="{xen:if '{$loop.cyclenumber} % 2 == 1', 'primaryContentDark', 'primaryContent'}"> </xen:foreach> Now {$i} will increment for each iteration. {$count} will just have the total number of array elements.
C covort New member Aug 22, 2012 #3 t Jake Bunce said: Rich (BB code): <xen:foreach loop="$RecentNews" value="$news" i="$i" count="$count"> <div class="{xen:if '{$loop.cyclenumber} % 2 == 1', 'primaryContentDark', 'primaryContent'}"> </xen:foreach> Now {$i} will increment for each iteration. {$count} will just have the total number of array elements. Click to expand... Thank you
t Jake Bunce said: Rich (BB code): <xen:foreach loop="$RecentNews" value="$news" i="$i" count="$count"> <div class="{xen:if '{$loop.cyclenumber} % 2 == 1', 'primaryContentDark', 'primaryContent'}"> </xen:foreach> Now {$i} will increment for each iteration. {$count} will just have the total number of array elements. Click to expand... Thank you