Re: [SMARTY] Registering plugins inside a class?

From: Date: Thu, 13 Feb 2003 13:32:59 +0000
Subject: Re: [SMARTY] Registering plugins inside a class?
References: 1 2 3 4  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7725@lists.php.net to get a copy of this message
> > 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. As you said, modifiers don't get a reference. And I'm missing it :) Maybe it could be changed, that _every_ function get a reference as first parameter? (O.K. this would make it incompatible to older versions, but that's the price...) BTW, what exactly is that reference? When I derive several classes (e.g. MySmarty extends Smarty and MyOther extends MySmarty) to which class does it point? To the same from which "->display" (or "->fetch" or ...) has been called? Or always to something inside the baseclass Smarty? > > 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. Hmm. Would this solve the problem with using class-functions? The function which dispatches the stuff must then again be a regular function and may not be a class-method. Or am I wrong? What's the reason, that Smarty could not dispatch anything to the class in which the object is instanciated? Is this a PHP limitation or is my thinking going in the wrong direction? (I'm relatively new to PHP :)) with regards, Matthias

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