Re: [SMARTY] 3 photos at one row
| From: | Monte Ohrt | Date: | Fri, 21 Nov 2003 15:38:10 +0000 |
| Subject: | Re: [SMARTY] 3 photos at one row | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10581@lists.php.net to get a copy of this message | ||
On Fri, 2003-11-21 at 08:38, Jan Rosier / Interstroom wrote:
> Or give this a try:
>
> <TABLE>
> <TR>
> {section name=row loop=$images}
> <TD>{$images[row].src}</TD>
> {if ($smarty.section.row.rownum % 3) eq 0 AND not
> $smarty.section.row.last}</TR><TR>{/if}
> {/section}
> </TR>
> </TABLE>
Just an FYI, you can optionally use some syntactic sugar:
{if $smarty.section.row.rownum is div by 3 AND not
$smarty.section.row.last}
in case you want to help keep your templates understandable
by the non-programmer types :) Basically, 'X is div by N' is a synonym
to 'X % N == 0'
Monte