Re: [SMARTY] Help : section & loop

From: Date: Thu, 09 Sep 2004 12:20:36 +0000
Subject: Re: [SMARTY] Help : section & loop
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11781@lists.php.net to get a copy of this message
On Thu, Sep 09, 2004 at 02:13:51PM +0200, Toorop wrote: > Hi, > > I didn't find how to do a template : > > My array : > > $my_array=Array > ( > [dupont] => Array > ( > [id] => 38 > [prenom] => titi > [adresse] => DupontTown > . > . > . > ) > > [martin] => Array > ( > [id] => 43 > [prenom] => toto > [adresse] => MartinTown > . > . > . > ) > > ) > > I want a output like : > > dupont | titi | DupondTown > martin | toto | MartinTown > > But i find anything working :/ > > > My *not working* template : > > {section name=num_loop loop=$my_array} > <tr class="{cycle values="TabLigne1,TabLigne2"}"> > <td height="21" >{i really don't know how to show tab key, ie > dupont for the first loop}</td> > <td >{$mon_tableau[num_loop].prenom}</td> // Not working show nothing > <td >{$mon_tableau[num_loop].adresse}</td> // Not working show nothing > . > . > . > </tr> > {/section} {section} doesn't work with hash indizes, use {foreach}: {foreach from=$my_array item=element key=name} <tr class="{cycle values="TabLigne1,TabLigne2"}"> <td height="21" >{$name}</td> <td >{$element.prenom}</td> <td >{$element.adresse}</td> </tr> {/foreach} greetings messju > > > Escuse my poor english, i hope you understand my problem, Thx ;-) > > > -- > Toorop

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