Re: [SMARTY-DEV] optional spaces for modifiers
| From: | Monte Ohrt | Date: | Mon, 05 May 2003 14:44:38 +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-1345@lists.php.net to get a copy of this message | ||
{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>