Re: [PHP Template] Repeating values

[email protected] (Dan Libby) Wed, 01 Mar 2000 01:47:10 -0800
Newsgroups php.template
Message-ID <[email protected]>
Okay.  Suppose we wanted to make our sections into variables that can be used
elsewhere.

Here is a simple case:

{{section:fruits}}
{{$fruit}}
{{/section}}

So if there are three fruit, this might be:
apple
orange
banana

Now lets suppose we have another section, names.
{{section:names}}
{{$name}}
{{/section}}

This might be:
dan
andrei

Now suppose that we want to create a new section, name_fruits.  There are
different sets of output we might expect:

dan apple
andrei orange

or

dan apple
andrei orange
banana

or

dan apple
dan orange
dan banana
andrei apple
andrei orange
andre banana

Often you will want the first version, but sometimes not.  I refer to this choice
as collation rules.

Now suppose that you want to do this collation, but you don't want to actually
display "names"... just use it as a variable.  That means there needs to be some
sort of display="no" setting that indicates this section is just for defining a
variable.  This attr is also nice because you can define a bunch of sections at
the top of the file and then re-use them elsewhere.

This reminds me.... I don't think we ever added get/post args to the spec.  That
seems like a very useful thing to have.   That way a html person can pass args
from template a to template b (via url b) without requiring any php code changes.
Or is that crazy talk?  I don't see how it is much different from config vars.

-dan

Andrei Zmievski wrote:

> At 04:19 PM 2/29/00 -0800, Dan Libby wrote:
> >I think it would be a useful feature.  However now you are starting to get
> into
> >the area of collation.  Previously I worked with a template language that had
> >several options for collating multiple lists.  It gets a bit tricky....   ;-)
>
> Dan,
>
> Can you explain more about collation and how it can be applied here?
>
> -Andrei
>
> --
> 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]