Variable as array index
| From: | Duke Ionescu | Date: | Tue, 03 Dec 2002 22:36:52 +0000 |
| Subject: | Variable as array index | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6625@lists.php.net to get a copy of this message | ||
Say I have:
$sm->assign('people', array(
array('id' => 4, 'name' => 'Duke Ionescu'),
array('id' => 8, 'name' => 'Big Lebowsky')
));
I want to do the following:
{section name=idx loop=$people}
{$people[$smarty.section.idx.iteration-1].name}<br />
{/section}
Any way to do it or do I have to do it in php?