Re: [SMARTY-DEV] optional spaces for modifiers

From: Date: Mon, 05 May 2003 14:57:41 +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-1347@lists.php.net to get a copy of this message
--- Monte Ohrt <monte@ispi.net> wrote: > {if $var | upper ne "blah"} > > that works? Nope. I didn't support that. You have to write it like: {if $var |upper ne "blah"} So the "|" becomes the first char of a mod (like a var starts with "$"). If you use parameters, the first ":" must immediately follow the mod name. here are the additional supported cases: // |foo: "bar" // |foo: $bar // |foo: "bar" : $foobar // |foo |bar That means that: {if $var |foo: "p1" : $p2 neq $var2 |bar: "p3" : "p4"} and {if $var |foo: "p1" : $p2 |bar: "p3" neq $var2 |bar: "p3" : "p4"} work. --- Monte Ohrt <monte@ispi.net> wrote: > {if $var | upper ne "blah"} > > that works? > > > > On Mon, 2003-05-05 at 09:36, boots wrote: > > Actually, I haven't found that it breaks anything at all, including > > if's. Well, at least it hasn't broken anything on my usual test > > platform this weekend ;). > > > > Anyways, even if it turns out to break something, I'm sure I could > find > > a non-breaking way to get the optional spaces working. Are there > strong > > objections? > > > > --- Monte Ohrt <monte@ispi.net> wrote: > > > Try that in an IF statement, it will break for sure. > > > > > > On Fri, 2003-05-02 at 17:44, boots wrote: > > > > --- 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 > -- > Monte Ohrt <monte@ispi.net> > __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com

« previous php.smarty.dev (#1347) next »