Re: Stupid array question : precision

From: Date: Mon, 20 Aug 2001 00:30:20 +0000
Subject: Re: Stupid array question : precision
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1366@lists.php.net to get a copy of this message
I think your array should be indexed starting with 0. Or try >>{$article_corps[data.index-1].paragraph_id}... in your section ----- Original Message ----- From: "Luc Saint-Elie" <luc@saint-elie.com> To: <smarty@lists.ispi.net> Sent: Saturday, August 18, 2001 11:16 AM Subject: [smarty] Re: Stupid array question : precision > Mike, > > You're right, but for a reason I fail to find out with data the result is > exactly the same > > I get displayed $myarray[1] and .. that's all.. apparently the loop is > donne through $array[1] > and doesn't reach $array[2]...$array[n] > Its why I tried to use the index > > So to ask my question in another way > > What is the right section code to display an array of the form > Array > ( > [1] => Array > ( > [paragraph_id] => > [paragraph_title] => foo tile > [paragraph_chapo] => foo chapo > [paragraph_text] => foo text > ) > > [2] => Array > ( > [paragraph_id] => 2 > [paragraph_title] => foo title > [paragraph_chapo] => foo chapo > [paragraph_text] => foo text > ) > [n] => Array > ( > [paragraph_id] => n > [paragraph_title] => foo title > [paragraph_chapo] => foo chapo > [paragraph_text] => foo text > ) > ) > > Luc > > At 18:11 18/08/01 +0200, Mike Krus wrote: > >Luc Saint-Elie wrote: > >>{section name=data loop=$article_corps} > >>{$article_corps[data.index].paragraph_id}&nbsp;{$article_corps[data.index] .paragraph_title} > >> > >>{$article_corps[data.index].paragraph_chapo} > >>{$article_corps[data.index].paragraph_text} > >>{/section} > >shouldn't it be: > > > >{section name=data loop=$article_corps} > >{$article_corps[data].paragraph_id}&nbsp;{$article_corps[data].paragraph_ti tle} > > > > > >{$article_corps[data].paragraph_chapo} > >{$article_corps[data].paragraph_text} > >{/section} > > > >the 'data.index' syntax is to print the index value... > > > > > >Mike > > > --- > You are currently subscribed to smarty as: sweatjejm@home.com > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/

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