Re: [SMARTY-DEV] Re: static object access
| From: | Monte Ohrt | Date: | Mon, 27 Jan 2003 14:57:13 +0000 |
| Subject: | Re: [SMARTY-DEV] Re: static object access | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-633@lists.php.net to get a copy of this message | ||
This affects a lot of things. Basically you could use a call to an
object like this anywhere you can use a php function directly:
*) in IF statements:
{if foobar::foo($bar)}...{/if}
*) in object calls (long format)
{$foo->bar(foobar::foo($bar))}
*) as modifiers (?)
{$foo|foobar::foo}
It also affects security. With security enabled, can you access objects
statically? Can you only access registered objects? How do you allow
them selectively, along with allowed functions?
We could leave this support out for now. You can always use your own
wrapper for it:
{if sto("foo","bar")}
{$foo|sto:"foo":"bar"}
Monte
On Mon, 2003-01-27 at 03:54, André Rabold wrote:
> I have already thought about that, too. But I'm not sure if you really need
> it. Most time
> you could easily assign a real object to the template and call it's methods.
>
> I have some classes with static methods but for now I haven't had to call
> them from within
> my templates. Static method calls work exactly the same as plugin functions.
> Normal calls
> behave a bit different because they depend on the values of the current
> object. So there's
> a reason for supporting object method calls. But I don't see one for static
> calls.
> On the other hand if you include real OOP support in Smarty you have to make
> static
> method call possible.
>
> André
>
>
> "Monte Ohrt" <monte@ispi.net> schrieb im Newsbeitrag
> news:1043438783.9329.15.camel@lena.ispi.prv...
> > Do we need to support this?
> >
> > {if foobar::is_empty($foo)}
> > ...
> > {/if}
> >
> > I noticed we had a template with this in it, and the old Smarty
> > supported it, mostly on accident because it just passed the syntax
> > through to PHP. The new parser stops and gives an error.
> >
> > Monte
> >
--
Monte Ohrt <monte@ispi.net>