Re: [PHP Template] Looping and nested sections
[email protected] (Dan Libby) Mon, 28 Feb 2000 21:13:44 -0800
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
I like this approach. It is very inheritance-esque and even allows you to reference
the value 3 levels up if you
want. It also doesn't change the semantics of what a section is, depending on
context. I don't have anything to add.
-dan
> Something similar was discussed on this topic earlier. I think it would
> be handy to be able to identify a variable with its section name,
> something like:
>
> {{$sectionname:foo}}
>
> would print the current value of foo for the section. If the section is
> omitted and you are within a section block, then the current section is
> assumed. With this in mind, you could re-loop every value no matter what
> is nested.
>
> example:
>
> {{section sec1}}
> ...
> {{ $foo }}
> {{ $sec1:foo }} <!-- prints the same variable as $foo -->
> ...
> {{section sec2}}
> ...
> {{ $foo }}
> {{ $sec2:foo }} <!-- prints the same variable as $foo -->
> {{ $sec1:foo }} <!-- prints value of outer section foo variable -->
> ...
> {/section}}
> {{/section}}
>
> --
> PHP Template Engine Mailing List
> Current engine specification can be found at:
> http://va.php.net/~andrei/tpl-engine-spec.txt
> To unsubscribe, e-mail: [email protected]