(fwd) Re: [PHP Template] <..> or {{..}} - vote?
[email protected] (Andrei Zmievski) Wed, 23 Feb 2000 08:30:21 -0600
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 22 Feb 2000, Cyrix Haldir wrote:
> that's right, but my idea was slightly different. Something like this:
> -> PHP open the template file and read it (if necessary,
> it should first check in cache and check if template file didn't
> change)
>
> -> Then feed it to a first parser, which seeks for {{, }},<!-- {{, }}
> -->,
> < and > _and then translate the signs to {{ and }}_ (and eventually
> make
> some sanity & syntax check on template file)
>
> -> the first parser store the result in cache
>
> -> Then a second parser fetch the template from cache, read it and
> makes the right substitutions, feeding the result to apache.
>
> so the feared parser overhead would happen only in step 2, which most of
> the time will be avoided. Basically, step 2 is something like a regular
> expression.
> It would slow down things only if someone deactivate cache, but man,
> probably in this case he is not interested in performance :-)
This would not help much.
The way engine is planned right now is that there is a compiler that
goes through the template file and compiles it into an intermediate form
which is then cached. Then the executor goes through and parses the
template when tpl_fetch() is called.
With your suggestion, it would still need to look for < and > on the
first pass and then for {{ and }} on the second pass. Since it already
does look for {{ and }} only once, there wouldn't be much savings..
-Andrei
* Use the source, Luke. *