Can a Zend Framework export help me with partialLoops?
Posted: Mon Apr 20, 2009 5:06 pm
I am using a partialLoop and I am looking for a way to have a variable persist across iterations of the partial loop.
Here is a simple example of the sort of thing that I would like to do:
So in this example I would like the $count variable to increase in value with each iteration of the loop. However, what happens instead is that the $count is reset to 1 each time. This could be great for alternating row colors, making the first X number of items in a list stand out, etc.
Can anyone help me out with this?
Thanks,
Josh
Here is a simple example of the sort of thing that I would like to do:
Code: Select all
<li>
<?= $this->value // Value from an array, this part works great ?>
<? if( !isset($count) ) $count = 1;
else ++$count // Persistent value ?>
<?= $count ?>
</li>Can anyone help me out with this?
Thanks,
Josh