RE : [SMARTY] if with incremental numbers
| From: | Christopher Rousseau | Date: | Wed, 09 Jul 2003 10:46:44 +0000 |
| Subject: | RE : [SMARTY] if with incremental numbers | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9855@lists.php.net to get a copy of this message | ||
Try something like this : (doc smarty 2.5.0 pdf, page 39)
{if ($i is div by 4)}
{/if}
-----Message d'origine-----
De : Olivier Doucet [reagi.com] [mailto:webmaster@ajeux.com]
Envoyé : mercredi 9 juillet 2003 11:35
À : smarty-general@lists.php.net
Objet : [SMARTY] if with incremental numbers
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
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php