Re: [SMARTY] foreach in reverse
| From: | boots | Date: | Thu, 11 Aug 2005 20:59:14 +0000 |
| Subject: | Re: [SMARTY] foreach in reverse | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12948@lists.php.net to get a copy of this message | ||
--- Matt Warden <mwarden@gmail.com> wrote:
> smarties,
>
> I was hoping that there was a way to do a foreach in reverse (i.e.,
> starting with the last element and ending with the first). After
> seeing that there doesn't seem to be, I tried to work out the
> equivalent of a 'foreach in reverse' with sections and a negative
> step. Does someone have an example of doing this?
Hi.
I assume that this would work:
{foreach from=$myarray|@array_reverse:true item=foo} ...
See:
- http://smarty.php.net/manual/en/language.modifiers.php
- http://php.net/array_reverse
HTH
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com