Re: [PHP Template] Looping and nested sections

From: Date: Wed, 01 Mar 2000 00:02:16 +0000
Subject: Re: [PHP Template] Looping and nested sections
References: 1 2 3 4  Groups: php.template 
Request: Send a blank email to php-template+get-257@lists.php.net to get a copy of this message
Andrei Zmievski wrote: > So, does this mean that $foo would be re-looped inside sec2? What if you > refer to $sec3:bar and $sec3 has not been executed yet? No, it is referring to the scalar value of $foo as it exists in the current iteration of sec2. If you refer to a section that has not been executed yet, then it is undefined like any other undefined var, with the same behavior. > Just thinking maybe we should keep ':' for future extensions? :) It's > such a nice delimiter. Sure. Do whatever makes sense with the syntax... :-) > > > On Mon, 28 Feb 2000, Dan Libby wrote: > > 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. > > > > > > 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}} > > -Andrei > > "Claiming Java is easier than C++ is like > saying that K2 is shorter than Everest." > -- Larry O'Brien (editor, Software Development) > > -- > 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

« previous php.template (#257) next »