Re: [SMARTY-DEV] optional spaces for modifiers
| From: | boots | Date: | Fri, 02 May 2003 22:44:50 +0000 |
| Subject: | Re: [SMARTY-DEV] optional spaces for modifiers | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1332@lists.php.net to get a copy of this message | ||
--- Monte Ohrt <monte@ispi.net> wrote:
> That would throw a wrench into the gears :-) For one, I think IF
> statements would be too ambiguous to parse correctly.
>
> On Fri, 2003-05-02 at 17:12, boots wrote:
> > What are thoughts on supporting {$var |mod : "p1" |mod2} ?
I'll have to check. I'm using a patched regexp in the smarty compiler
(replaced the first line of the modifier syntax (near line 150).
from:
$this->_mod_regexp = '(?:\|@?\w+(?::(?>-?\w+|'
to:
$this->_mod_regexp = '(?:\s*\|@?\w+\s*(?:\s*:\s*(?>-?\w+|'
so it supports:
// |foo: "bar"
// |foo: $bar
// |foo: "bar" : $foobar
// |foo |bar
The only caveat is that : must follow the mod name.
To me,
{$var |mod1: "param1" : "param2"
|mod2: "param21" : "parm22"}
looks nicer than:
{$var|mod1:"param1":"param2"|mod2:"param21":"parm22"}
I haven't had problems ;) but I haven't tested too rigorously yet.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com