Re: [SMARTY] Getting information about the template name

From: Date: Mon, 06 Jun 2005 07:05:20 +0000
Subject: Re: [SMARTY] Getting information about the template name
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12670@lists.php.net to get a copy of this message
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

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