Re: A bug in section loop

From: Date: Tue, 17 Jul 2001 13:24:56 +0000
Subject: Re: A bug in section loop
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1180@lists.php.net to get a copy of this message
And how are you going to access the index of other variables within the section loop using a foreach() loop? That is why we didn't use it. Ivo Jansch wrote: > > Hi, > > Andrei Zmievski wrote: > > > The arrays you are looping through with {section} are supposed to be > > contiguous. > > Would it not be nice if you could support non contiguous arrays as well? > It's quite easy. You just have to change your loop a bit. > > Instead of a 'normal' loop, like > > for($i=0;$i<count($array);$i++) > { > echo $array[$i]; > } > > you could do: > > foreach($array as $key => $value) > > { > echo $value; > } > > This way you could even loop associative arrays.. > > Greetings, > Ivo > > -- > Ivo Jansch <ivo@ibuildings.nl> > ibuildings.nl BV - information technology > http://www.ibuildings.nl > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

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