|
Posted by "Cal Henderson" on 06/06/05 10:05
Erik Schmitt wrote:
: I would like to access the name of current template
: directly from the Smarty-object (inside my own
BLOCK-function).
: Is this possible? I searched the documentation but
: found only {$smarty.template}, which does not help me.
a quick print_r reveals it's stashed in the smarty
object. try a function like this:
function myfunc($args, $smarty){
$tmpl = $smarty->_plugins['function']['myfunc'][1];
...
}
$smarty->register_function('myfunc', 'myfunc');
but that doesn't work for included templates. to get
the template name inside includes you'll need to patch
your Smarty.class.php file with the patch here:
http://code.iamcal.com/php/smarty/current_template/diff.txt
then you can access it like this:
function myfunc($args, $smarty){
$tmpl = $smarty->current_template();
...
}
--cal
Navigation:
[Reply to this message]
|