if with incremental numbers
| From: | Olivier Doucet [reagi.com] | Date: | Wed, 09 Jul 2003 10:35:23 +0000 |
| Subject: | if with incremental numbers | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9853@lists.php.net to get a copy of this message | ||
Hi all
I'm looking for a simple way to do a 'if' every X lines... Hem example will
be easier to understand :
{foreach from=$blabla name=bla key=i}
[...]
{if $i == 4 || $i == 8 || $i==12}
{/if}
[...]
{foreach}
The $i==4 || etc. is not very efficient.
In php i would use if (rand($i/4)==($i/4))
How can I do this in the template (i can't use {php}{/php} ?
Must I use the 'math' function (which is very slow and inappropriate) ?
Thx a lot
Olivier Doucet
www.ajeux.com