Re: [SMARTY-DEV] object syntax php-style
| From: | Monte Ohrt | Date: | Wed, 22 Jan 2003 16:28:45 +0000 |
| Subject: | Re: [SMARTY-DEV] object syntax php-style | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-591@lists.php.net to get a copy of this message | ||
I just picked the most complicated situations I could think of. But,
objects can be used just like any other assigned variable. You can pass
them to functions, use them in section loops and nested arrays, they
respect template security settings, etc. These are all things you would
not accomplish with {php}{/php} tags.
Take a look at this (no objects):
{$foo.bar[my_index].$myfoo[sec_1][sec_2]|regex_replace:"[\r\n\t]+":" "}
That is valid, and is pretty "Oh my God" looking to me too.
Monte
On Tue, 2003-01-21 at 21:23, Andrei Zmievski wrote:
> On Tue, 21 Jan 2003, Monte Ohrt wrote:
> > Since the current CVS is pretty much non-working, I committed back in
> > the support for native PHP object syntax.
> >
> > These are all complicated looking, but valid syntax:
> >
> > {$foo->bar('hey', $foo, "bar")}
> > {myfunc param=$foo->bar('hey', $foo, "bar")
> > param2="blah"}
> > {$foo.bar.blah[0].myObj->myMethod($foo.bar[myloop], "fooblah")|upper}
> > {$foo->bar->foobar($foo)}
> >
> > You cannot pass objects as parameters to objects.
> > Private method access respects the Smarty security setting.
> >
> > If we can't find an effective way to handle objects with the current
> > Smarty syntax, this may have to be it.
>
> Oh my God... might just as well use {php} .. {/php} or something..
>
> -Andrei
> http://www.gravitonic.com/
>
> "Claiming Java is easier than C++ is like
> saying that K2 is shorter than Everest."
> -- Larry O'Brien (editor, Software Development)
--
Monte Ohrt <monte@ispi.net>