Re::comments on the template engine example document
[email protected] (jm) Thu, 23 Mar 2000 17:20:59 +0000
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
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)
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)
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
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.
At 10:49 23/03/00 -0600, you wrote:
>On Thu, 23 Mar 2000, jm wrote:
> > First, would it be possible to use
> > <!-- tplrem here a template comment -->
>
>Yes, you can use either { and } as delimiters, or <!-- { and } -->. So
>you could do:
>
><!-- {* comment *} -->
><!-- { section name="blah" }-->
>
> > Can section be named ? so more than one can be used in the same template
>
>Of course. It's even possible for several sections to have the same
>name.
>
> > One stuff that might be useful is some kind of "scope" for the variables,
> > in order to tell in what loop section it does belongs...
>
>What do you mean?
>
> > Using multiple sections allow to keep all the logic in the php code, have
> > just one file for all the cases and give as much freedom as possible to
> the
> > designers
> > (and yes, sometimes the designers gave feedback or requirement for the
> > design and the template and the logic are changed)
> >
> > I hope my example was clear...
> > I found that quite powerful and therefore my rejection of "logic" stuff
> > directly in the template.
>
>Like I said, the engine is pretty flexible. You can do your conditionals
>using sections controlled from PHP script or you can do an occasional
>'if'.
>
> > Another thing you might want to consider is that
> > not all people are native english speaker and a
> > {section}
> > {alternate}
> > {/section}
> > is as complicated for them as some php code.
>
>Well, {alternate} is about the best I could come up with. If you have a
>better suggestion, please let us know.
>
>-Andrei
>* Black holes are where God divided by zero. *