Re: [SMARTY] array starting at index 1
| From: | Wom.bat | Date: | Fri, 07 Nov 2003 22:16:30 +0000 |
| Subject: | Re: [SMARTY] array starting at index 1 | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10508@lists.php.net to get a copy of this message | ||
why don't you just use {foreach from=$edits item="edit"}...{/foreach}
David
On Friday, November 07, 2003 11:10 PM +0200, Chadwick, Russell wrote:
> 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
> )
> )