Re: [SMARTY] Using different starting and ending delimiters
| From: | Mark Rogers | Date: | Thu, 20 Nov 2003 18:14:40 +0000 |
| Subject: | Re: [SMARTY] Using different starting and ending delimiters | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10570@lists.php.net to get a copy of this message | ||
Monte Ohrt writes
> Claas Diederichs wrote:
> > I would like to use both types of delimiters:
> > <!--{}-->
> > and
> > {}
>
> Yes, use a prefilter to convert <!--{ }--> to {}.
I haven't tried this, but a brief look at the code suggests that it ought to
be possible to support an array of each delimiter type, modifying the
preg_match so that in Smarty_Compile::_compile_file() $ldq becomes
'(?:<!--{|{)' (or whatever that would be after the relevant parts of it are
passed through preg_quote).
[For those not used to regular expressions, (<!--{|{) would match either
<!--{ or {, and store it as a matched substring; the ?: stops it getting
stored.]
There's a little more to it than this, as the delims are used in a couple of
other places too, but the basic principle should work and it ought to be
quite a simple change?
It would be very useful for people wishing to change delimiters but retain
backwards compatibility with old templates.
Mark Rogers,
More Solutions Ltd