Smarty custom plugin to use base class

Vethro

New Member
Here is my class that gets called on each page:\[code\]class ActionHandler { var $smarty = NULL; public function __construct() { if($this->smarty == NULL){ $this->smarty = new Smarty(); $this->smarty->template_dir = TEMPLATE_DIR; $this->smarty->compile_dir = COMPILE_DIR; } } public function do_something($page_id) { return $page_id + 1; }} \[/code\]Now I have a custom plugin for smarty that I want to use in my template:\[code\]function smarty_function_something($params, &$smarty) { return ActionHandler::do_something($params['page_id']);}\[/code\]However I get \[code\]Fatal error: Using $this when not in object context.\[/code\]I see why but don't know how to get around this. Any ideas?
 
Back
Top