Re: [SMARTY-DEV] nested ...templates?
| From: | boots | Date: | Mon, 15 Dec 2003 05:14:03 +0000 |
| Subject: | Re: [SMARTY-DEV] nested ...templates? | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1985@lists.php.net to get a copy of this message | ||
--- Andrei Zmievski <andrei@gravitonic.com> wrote:
> On Fri, 12 Dec 2003, Monte Ohrt wrote:
> > We can't do recursion with the tokenizer (unrolling bracket pairs),
> > so these kind of things are out of the question. Maybe at some
point
> > we can move away from using preg_* for the parser, but that isn't
> > too practical
> > at the moment.
>
> Unless you write a custom C extension to parse the template, preg_*
> is your best bet. I can't imagine how much slower a parser written in
> pure PHP (without preg_*) would be.
Very true.
Here is a very simple modification to the regex which gives a different
precedence for {** **} as per Monte's suggestion. Actually, this change
should allow for any number of levels (eg. {*** ***} not that it really
means much. The caveat is that this won't work properly unless the
"higher-order" comments wrap the "lower-order" comments, so a better
implementation would be welcome.
Basically, instead of checking for {* .. *} this checks for {(*+) ..
\1}, if you see my meaning.
xo boots
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/