array starting at index 1
| From: | Chadwick, Russell | Date: | Fri, 07 Nov 2003 22:10:02 +0000 |
| Subject: | array starting at index 1 | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10507@lists.php.net to get a copy of this message | ||
Hello all, I tried quite a few approaches to this. Hopefully someone can help me
I am trying to iterate through a multidimensional array and the first element is index 1 instead of
the usual 0. When I set the start=1 it causes it to not display the last item, meaning $edits[4] in
this case. I tried using a foreach also, no luck.
Thanks for your help - Russ
This is my template:
{section name=edit start=1 loop=$edits}
<tr class="table_{cycle values="odd,even"}_row">
<td>{$edits[edit].title}</td>
</tr>
{/section}
Where edits is assigned to this:
Array
(
[1] => Array
(
[title] => Map ID
)
[2] => Array
(
[title] => Tile ID
)
[3] => Array
(
[title] => X Coord
)
[4] => Array
(
[title] => Y Coord
)
)