Re: [SMARTY] section and columns

From: Date: Tue, 02 Mar 2004 18:19:13 +0000
Subject: Re: [SMARTY] section and columns
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11041@lists.php.net to get a copy of this message
Use one table row and move to the new column when the loop is divisible by four, so something like (untested): <table> {section name=category loop=$categories} <tr> <td> <a href="{$categories[category].url}">{$categories[category].name}</a> {if not $smarty.section.category.last} {if $smarty.section.category.iteration is div by 4}</td><td>{else}<br />{/if} {/if} </td> </tr> {/section} </table> On Tue, 2004-03-02 at 12:04, Uros Gruber wrote: > Hello! > > Let say I have some array of data > > and I show it like this > > <table> > {section name=category loop=$categories} > <tr> > <td> > <a href="{$categories[category].url}">{$categories[category].name}</a> > </td> > </tr> > {/section} > </table> > > Is it now possible to rewrite tpl file so I can for example make > output in two, three, four columns. So designer can choose how much > columns to use. > > > example output > > cat1 cat5 cat9 > cat2 cat6 cat10 > cat3 cat7 cat11 > cat4 cat8 > > Right now I have to use array chunk before I assign array to smarty > and then in tpl file I have to use sub section. > > Is this even possible? > > -- > tia, > Uros

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