Re: [SMARTY] Need both Section and Foreach functionality.
| From: | Rob Adams | Date: | Wed, 16 Apr 2003 22:58:12 +0000 |
| Subject: | Re: [SMARTY] Need both Section and Foreach functionality. | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9287@lists.php.net to get a copy of this message | ||
"Messju Mohr" <messju@lammfellpuschen.de> wrote in message
news:20030416222653.GA17637@pharao.lammfellpuschen.de...
> On Wed, Apr 16, 2003 at 03:39:37PM -0600, Rob Adams wrote:
> > Hi. Long time reader, first time poster.
> >
> > I have a {foreach ...} and I need to be able to get which loop I'm on
inside
> > of it. I've tried stuff like:
> > $smarty.foreach.foreach_name.index
> > $smarty.foreach_name.index
>
> {foreach key=index ...} .... {$index} ...
> to get the current index in an associative array
>
> { foreach name=foo ...} ... {$smarty.foreach.foo.iteration} ...
> to get the current iteration (=integer-count) of the specific loop.
Thank you. That was exactly what I was looking for. I should've guessed
that there was an iteration field for foreach as well as section.
-- Rob
>
> HTH
> messju
>
> > I've also looked through all the messages I could find in the newsgroup.
I
> > have an associated array, but I also need to know which iteration of the
> > loop I'm on. Is there currently a way to do this? Thanks.
> >
> > -- Rob