|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
shnapoo Smarty Rookie
Joined: 26 May 2010 Posts: 6
|
Posted: Sun Jul 18, 2010 9:29 am Post subject: Getting current template path |
|
|
Hi,
how do I know the current template path from inside a plugin routine? I've searched everywhere, but couldn't find a solution, not even here or in the docs. The $smarty object seems to contain a list of template_objects. But how to know which of them calls the plugin routine?
TIA, Shnapoo |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Jul 18, 2010 1:31 pm Post subject: |
|
|
In Samrty 3 the template object gets passed as 3rd paramter.
smarty_function_foo($params,$smarty,$template)
You can get the filepath with
$template->getTemplateFilepath (); |
|
Back to top |
|
shnapoo Smarty Rookie
Joined: 26 May 2010 Posts: 6
|
Posted: Sun Jul 18, 2010 2:51 pm Post subject: |
|
|
That's great, thanks a lot!
The $template seems always to be passed in as last parameter for all types of plugins. In my case it's a block plugin with the signature below:
smarty_block_foo($params, $content, $smarty, $repeat, $template) |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|