is it possible to use variables as array subscripts in smarty
| From: | Henry | Date: | Thu, 05 Dec 2002 17:44:12 +0000 |
| Subject: | is it possible to use variables as array subscripts in smarty | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6661@lists.php.net to get a copy of this message | ||
Hi All,
You'll have to excuse me (it will be clear that) I haven't actually used
smarty yet but I have this question.
In a template file for example arrayele.tpl is it possible to use a variable
as a subscript to an array such as:
This is the element at {$index}, {$array[$index]}
Is that possible? The example given in the manual says,
"You can reference aray by their index, much like native PHP syntax.
Example 4.3 accessing arrays by index
{$contacts[0]}<br>....
But the manual doesn't make it clear. I could have just tried it but there
was a post on the 3/12/02 at 23:09 in this news group by Duke Ionescu that
refered to this that was not answered.
Hope you can assist.
Henry