Re: [PHP Template] Looping and nested sections

[email protected] (Dan Libby) Tue, 29 Feb 2000 16:02:16 -0800
Newsgroups php.template
Message-ID <[email protected]>
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: [email protected]