I am working on converting a template toolkit project in Perl to PHP with Smarty. However I have been trying to find the equivalent of [% IF loop.index % 2 %] within a foreach loop for Smarty. I appreciate the answers.
I am working on converting a template toolkit project in Perl to PHP with
Share
If you’re simply looking to alternate a display by even/odd in Smarty, which I assume from the ‘%’ modulus operator (though I’m not familiar with Perl):
Alternatively, if you really care about the index value of an array variable …