Re: [SMARTY-DEV] Enable Smarty to handle class methods as filters, handlers etc!?

From: Date: Mon, 31 Mar 2003 12:45:35 +0000
Subject: Re: [SMARTY-DEV] Enable Smarty to handle class methods as filters, handlers etc!?
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1055@lists.php.net to get a copy of this message
On Mon, Mar 31, 2003 at 02:16:19PM +0200, Wom.bat wrote: > Hi, > > I usually use a little abstraction class to access smarty, it provides some > functions like an extended display() method, which assigns $_REQUEST, or a > constructor in which directories are set and filters are registered. > > Now I have encountered the following: I want to have, for obvious reasons, > my own pre/post/output-filters, cache handler function etc. within this > abstraction class. In the case of outputfilters, this is quite easy to > manage, I can just change > > $this->_plugins['outputfilter'][$function] > = array($function, null, null, false); > > to > > $this->_plugins['outputfilter'][((is_array($function)) ? $function[1] : > $function)] > = array($function, null, null, false); > > in function register_outputfilter() in Smarty.class.php > But now, if I want to have my own cache handler (this seems not to be > possible at the moment, as $function() is used to call this one) or > prefilters, I need to keep my functions outside my class or do some deeper > hacking into Smarty. > > I guess it's generally a good idea to make all of Smarty's methods, which > register any sort of function (be it a filter, or a resource handler, or a > cache handler), capable of handling class methods. > How about implementing something that is similar to most of php's functions' > capabilites to handle eiter a single function name or an array with both > class and function names in it...? yes, i thought about this also. i didn't have the time to add it yet. but i wouldn't add class-methods, i would more like object-methods instead. then one can register "array(&$this, 'my_filer_method')" as a callback. greetings messju > Just my 2 cents, > David > > > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Multimedia: funktioniert mit elektrischem Strom Kristian Köhntopp

« previous php.smarty.dev (#1055) next »