[eluser]Unknown[/eluser]
Hi all,
I'm trying to replicate what Smarty does with it's {cycle} function in a CI parser view file; namely, flip between a pair of values inside a parser variable pair, but I'm only seeing the first value output over and over again. Can anyone shed some light on what I'm doing wrong, and how to make it flip between "1" and "2" correctly?
Code:
<table>
<tr><th>Extn</th><th>Name</th><th>External(s)</th></tr>
<?php $i=1;?>
{staff}
<tr class="r<?php echo $i; ($i==1?$i++:$i--);?>"><td>{extn}</td><td>{name}</td><td>{externals}</td></tr>
{/staff}
</table>
I've used similar code to this in raw PHP for/foreach loops without problem before now...