Re: $smarty.section.loop_name.last
| From: | Eric Coleman | Date: | Mon, 02 Dec 2002 01:30:32 +0000 |
| Subject: | Re: $smarty.section.loop_name.last | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6609@lists.php.net to get a copy of this message | ||
Add 'last' to your $persons array, as each persons last name,
IE
$persons = array(
array(
'name' => 'John',
'last' => 'LastName',
'age' => 21 ),
...
);
{section loop=$person name=i}
First Name: {$person[i].name}
Last Name: {$person[i].last}
{/section}
"Tero Nurminen" <tenurmin@kauppa.turkuamk.fi> wrote in message
news:20021130011012.98731.qmail@pb1.pair.com...
> Let's say I have an assigned variable called $persons which is an array
> having a dimension called name. So normally it will be called in a section
> loop like this:
>
> $persons = array( array( 'name' => 'John', 'age' => 21 ),
> array( 'name' =>
> 'Chris', 'age' => 44 ) );
>
> {section loop=$person name=i}
> {$person[i].name}
> {/section}
>
> Is there a smarty variable to fetch me the last name of a person like
> there's a variable for the last value of an array: $smarty.section.i.last?
I
> tried $smarty.section.i.name.last, but it didn't seem to affect.
>
> Tero
>
>