Re: [PHP Template] Re::comments on the template engine example document
[email protected] (Andrei Zmievski) Thu, 23 Mar 2000 11:29:11 -0600
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 23 Mar 2000, jm wrote:
> Ok, some more explanations:
>
> What I mean with scoped variables is that
> <!-- section name=big loop -->
> the loop index is ($index) <br>
> <!-- section name=inner loop -->
> the loop index is ($second_index) <br>
> but I like to use ($index) too (and get the value from above) <br>
> <!-- section end -->
> <!-- section end -->
>
> and inside the php code I don't want to tell that the value $index inside
> the inner loop,
> since I gave the value during the activation of the big loop.
> This is not quite useful, and can be done without it.
>
> Or may be that is already implicit in your template engine,
> that if you don't give a value to a variable, it uses the "previous" one.
> (I confess I read quite quickly the specs)
This is already possible.
{section name=big_loop}
the loop index is {#INDEX}
{section name=inner_loop}
the loop index is {#INDEX}
but I like to use #big_loop/INDEX too (and get value from above)
{/section}
{/section}
> Now you say that two sections can have the same name.
> How can I, the coder, tell which one is the right one ?
> (having in mind of course that all sections not "activated" are not in the
> final html doc produced with the template)
Having more than sections named the same is useful. For example, in the
template I may have several sections named 'help' which display the help
text on the form. In the PHP script, I can easily hide/show all help
text by hiding/showing all sections with name 'help'.
> I do know your engine is flexible enough to do all I want.
> My point is that I'd like him to do just that,
> because a small engine is faster than a bigger engine.
> Or may be that would mean a fork in your code,
> to do a Light-engine version
> and a complete version.
> Which negates the fact that everyone seems to want ONE template engine,
> something like a standard way to do template in PHP
Well, as I mentioned, maybe we should wait until I have most of the
engine working and then people can try it out and see if it's fast
enough for them.
> And the "language" remark was about the previous discussion of coding the
> logic in PHP or in template and you saying it was clearer and simpler to do
> it in the template model.
> I was just pointing out that an ENGLISH keyword means something to an
> english speaker but doesn't mean nothing to a non native speaker...
> An analogy to be clearer: imagine your engine using latin keyword:
> the keyword then become just a keyword and not a "real-meaning" world.
It's only the difference between non-English speakers learning what
'section' means and everyone learning whatever the world in Latin for
'section' is.
-Andrei
* If it's never finished, you can't prove it doesn't work. *