Re: register_function inside class
| From: | Andrei Zmievski | Date: | Tue, 04 Dec 2001 14:16:25 +0000 |
| Subject: | Re: register_function inside class | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2117@lists.php.net to get a copy of this message | ||
On Mon, 03 Dec 2001, Pablo Martinez wrote:
> Hi,
>
> I am trying to add a custom function inside a class that I use to start
> things up with smarty. Here the code that I call at some point:
>
>
> function addCustomFuncs() {
> $this->register_function("link", "smarty_func_link");
> $this->register_function("image", "smarty_func_image");
> }
>
> THe functions are defined just before the class definition.
Is your class derived from Smarty class? Because otherwise I don't see
how it would register functions.
> First, it's not working. I keep getting an error saying the "link" tag
> is not defined (it's what I am testing first.). Any ideas?
>
> Second, I want to be able to use class methods as the functions. Is
> this possible?
>
> function addCustomFuncs() {
> $this->register_function("link", "this->smarty_func_link");
> $this->register_function("image", "this->smarty_func_image");
> }
I posted a message about this to the list yesterday. Basically, it's not
possible to do right now, but I got it working in our development
version. I asked the list what they thought about incorporating this
functionality because it may result in some performance issues, and I
haven't heard any outright approvals.
-Andrei
* If Bill Gates had a nickel for every time Windows crashed.. Oh, wait.. *