Re: Splitting rows with Smarty

From: Date: Wed, 18 Dec 2002 15:32:49 +0000
Subject: Re: Splitting rows with Smarty
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6875@lists.php.net to get a copy of this message
"Radu-Mihail Obada" <radu@fmi.unibuc.ro> schrieb im Newsbeitrag news:20021218145251.GB14279@fmi.unibuc.ro... > 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 >

« previous php.smarty.general (#6875) next »