You are here: Re: [SMARTY] Getting information about the template name « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Getting information about the template name

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация