Here is my class that gets called on each page:
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;
}
}
Now I have a custom plugin for smarty that I want to use in my template:
function smarty_function_something($params, &$smarty) {
return ActionHandler::do_something($params['page_id']);
}
However I get Fatal error: Using $this when not in object context.
I see why but don't know how to get around this. Any ideas?