Registering plugins inside a class?

From: Date: Thu, 13 Feb 2003 09:00:26 +0000
Subject: Registering plugins inside a class?
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7712@lists.php.net to get a copy of this message
Is it possible to register class-functions as plugin-functions? Here is an example, to understand what I mean: -------------------------------------------------------------------------- class MySmarty extends Smarty { function MySmarty { parent::Smarty(); $this->plugins_dir[] = "/myplugins"; $this->left_delimiter = "<{"; $this->right_delimiter = "}>"; $this->register_modifier( "test", "smarty_modifier_test" ); } function smarty_modifier_test( $sStr ) { // do something with the string: $sStr = $sStr + "_test"; return( $sStr ); } } -------------------------------------------------------------------------- after that I try to use the modifier "test" in my templates. But there will be always the error: "Smarty error: [in Template.tpl line 23]: [plugin] modifier 'test' is not implemented... I'm using Smarty 2.4.2 What's wrong? And how can I fix it? Or isn't it possible, to use class-functions as plugins? (BTW, I also tried "MySmarty::smarty_modifier_test" as function-string; same error) with regards, Matthias

« previous php.smarty.general (#7712) next »