Re: [SMARTY] Splitting rows with Smarty
| From: | Monte Ohrt | Date: | Wed, 18 Dec 2002 15:46:23 +0000 |
| Subject: | Re: [SMARTY] Splitting rows with Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6878@lists.php.net to get a copy of this message | ||
http://smarty.php.net/contribs/examples/dynamic_table_columns/table.tpl.txt
On Wed, 2002-12-18 at 08:52, Radu-Mihail Obada wrote:
> Hi,
> Say I have two variables avaiable in my Smarty template, let them be
> called $rowSplit and $images. I want to display the things stored in
> $images (which is an array) in a table, but I want the table to have no
> more than $rowSplit columns per row. And the question is: is there a way
> to achieve this in _the template_ code? For example, is it possible to do
> something like:
> {* this is not valid Smarty code *}
> <table>
> {foreach from=$images item=image key=index}
> {if $index is div by $rowSplit}
> <tr>
> {/if}
> {* OK, the part with the opening TR tag works *}
> {* but what to do with the closing tag? *}
>
> {* display cells with TD *}
>
> {if $index % $rowSplit eq $rowSplit -1} {* This doesn't work *}
> </tr>
> {/if}
> {/foreach}
> </table>
> ?
>
> Thanks in advance,
> Radu
--
Monte Ohrt <monte@ispi.net>