Re: [PHP Template] Looping and nested sections
| From: | Dan Libby | Date: | Tue, 29 Feb 2000 05:13:44 +0000 |
| Subject: | Re: [PHP Template] Looping and nested sections | ||
| References: | 1 2 | Groups: | php.template |
| Request: | Send a blank email to php-template+get-240@lists.php.net to get a copy of this message | ||
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: php4beta-unsubscribe@lists.php.net