Re: [SMARTY-DEV] Making variables accessible to the template in a block function
| From: | messju mohr | Date: | Fri, 21 Feb 2003 12:43:13 +0000 |
| Subject: | Re: [SMARTY-DEV] Making variables accessible to the template in a block function | ||
| References: | 1 2 3 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-799@lists.php.net to get a copy of this message | ||
On Fri, Feb 21, 2003 at 01:38:31PM +0100, messju mohr wrote:
> On Fri, Feb 21, 2003 at 01:26:59PM +0100, David Heinemeier Hansson wrote:
> > >your assumptions are correct. your block function gets called two times
> > >first with empty $content, second with $content containing the
> > >*already evaluated* contents between {repeat} and {/repeat}. so, this
> > >is a limitation.
> >
> > Uargh. That's a pretty nasty limitation since I won't be able to access
> > arrays then, like:
> >
> > {repeat times=10 counter=time}
> > {$myFirstVar.$time}
> > {$mySecondVar.$time}
> > {/repeat}
>
> instead of your repaet, you can use {section} or {foreach}
>
> http://smarty.php.net/manual/en/language.function.section.php
> http://smarty.php.net/manual/en/language.function.foreach.php
>
> for more complex block-functions, i don't know. i tried a solution via
> compiler-functions some time ago, but that was very complicated to
> handle, even simple tasks. so i'm still looking, too.
ahem, insert ^^^ "for".
>
>
> > Any other takers on alternatives to archive the above within the Smarty
> > limitations?
--
Kommentierter Quellkode: Hier programmiert ein Germanist oder Anglist.
Manfred Worm Schäfer