register_function inside class
| From: | Pablo Martinez | Date: | Mon, 03 Dec 2001 23:54:12 +0000 |
| Subject: | register_function inside class | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2109@lists.php.net to get a copy of this message | ||
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.
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");
}
Thanks for the help.
Pablo@phpshop.org