Re: [SMARTY] Registering plugins inside a class?

From: Date: Thu, 13 Feb 2003 11:14:47 +0000
Subject: Re: [SMARTY] Registering plugins inside a class?
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7720@lists.php.net to get a copy of this message
On Thu, Feb 13, 2003 at 10:47:16AM +0100, Matthias Mohr wrote: > Hi messju, > > > On Thu, Feb 13, 2003 at 10:00:26AM +0100, Matthias Mohr wrote: > > > Is it possible to register class-functions as plugin-functions? > . > . > . > > > What's wrong? And how can I fix it? > > > Or isn't it possible, to use class-functions as plugins? > > > > I'm afraid thats not possible. You have to write a wrapper function: > > > > function smarty_modifier_test( $sStr ) { > > return MySmarty::smarty_modifier_test( $sStr ); > > } > That's bad news. > > I would like to have easy access to all my class-variables and methods inside > the plugin-functions. except for modifiers all plugin-functions get a reference to $smarty supplied. you could add a property to $smarty that references your application-object and access it via $smarty->app->[function or property] from your plugins. > If possible, it would be a nice feature for a future version. > Then it would be possible to capsulate the whole smarty application-functionality > in an own class, including all the plugin-functions. another idea would be to add a $default_plugin_handler_func like $default_template_handler_func that is called if a plugin-function cannot be found. such a function could dispatch the call to the right object-method. i'd like to add this to smarty. in the moment i have not spare time for that but maybe in a few days. > > (BTW, I also tried "MySmarty::smarty_modifier_test" as function-string; same > > error) > > > > hmm, calls to static methods. i think it would be a nice addition if > > smarty supports that. maybe it is easy to add to the compiler-class, but > > i'm sure it's not supported by now. > That was only my fallback-test. Actually I would like to use it without that class identifier > and also with nonstatic methods... > > > (BTW: nice fullname! i like it for ages :-) > Me too :-) > Can it be, that your real name is exactly the same? yep. > now in German: > "mess" ist doch normalerweise auch eine Abkuerzung fuer Matthias, oder? > Nur das "ju" bringe ich nicht unter. Zweitname? noe, einfach wie mathew nur falsch und ohne tie-aeitsch ausgesprochen. > Wo wohnst Du? Oldenburg (das bei Bremen, nicht das in Holstein) > with regards, > Matthias Gruesse messju > P.S.: hast einen echt witzigen Domaenennamen. :)

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