Determining the name of the current Block/Function

From: Date: Thu, 02 Dec 2004 10:41:00 +0000
Subject: Determining the name of the current Block/Function
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12009@lists.php.net to get a copy of this message
I'm developing a wrapper (SmartyTemplate) around Smarty. However, due to the nature and purpose of my template engine I'm required to make use of Smarty as a member variable of SmartyTemplate rather than directly inheriting from it. Now, for most part this isn't a problem. However, for blocks and functions it's only possible to register block/function implementations with a particular signature - most notably, the last parameter must be a reference to a Smarty instance. I'd like to provide a single wrapper method that dispatches template function/block calls to a method that takes an instance of my wrapper class as that last parameter rather than a Smarty instance. If it helps, the PHP5 signature for such a block handler would probably look something like: public function mySmartyBlock ($params, $content, SmartyTemplate $template); So the wrapper method should be able to say "Hrm, which block am I being called for?" and then, using a lookup table of some sort, dispatch to the appropriate method/function using the new parameters. Hope this all made sense. It was rather difficult to put what I'm trying to accomplish into words. :) If anybody knows how I can determine the name of the block being called, it would be much appreciated. Alternatively, if there's somewhere in the source where I would be able to modify Smarty to meet my needs that would also be great. Thanks for any assistance. T

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