Re: Sv: Re: New looping method proposal

From: Date: Wed, 21 Nov 2001 08:15:11 +0000
Subject: Re: Sv: Re: New looping method proposal
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1995@lists.php.net to get a copy of this message
Hoi, Andrei Zmievski wrote:
{loop source=$array as=$element} {/loop} However, this doesn't account for the fact that you might want to access the array keys as well. Any suggestions?
{loop source=$data as=$element index=$i} {$element} and {$data[$i]} are then equivalent. {/loop} If you want to iterate through an associative array, you'd probably do: {loop source=$data as=$value index=$key} Greetings, Ivo -- Ivo Jansch <ivo@ibuildings.nl> ibuildings.nl BV - information technology http://www.ibuildings.nl

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