[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    [smarty] Re: Stupid array question : precision
From:       "Jason Sweat" <sweatjejm () home ! com>
Date:       2001-08-20 0:30:20
[Download RAW message or body]

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 leave-smarty-700385W@lists.ispi.net
> Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/


---
You are currently subscribed to smarty as: smarty@progressive-comp.com
To unsubscribe send a blank email to leave-smarty-700385W@lists.ispi.net
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic