Here is a simple example of the sort of thing that I would like to do inside of my partial:
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.
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?