|
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 |
SunFire Smarty n00b
Joined: 19 Sep 2003 Posts: 4
|
Posted: Sun Feb 06, 2005 5:15 am Post subject: howto access the name of current template in a plugin? |
|
|
hi, I need to access the name of the template my pluginfunction was invoked from. I tried to access {$smarty.template} from my function via the &$smarty parameter but it does not seem to work outside of the templates itself or I just do it wrong. Can someone maybe tell me how to realise this? I am searching for a while now in the docs as well as in the forum and google but with no luck.
Thnx in advance! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sun Feb 06, 2005 1:13 pm Post subject: |
|
|
{$smarty.template} is not available from the compiled template or from a plugin.
the easiest solution is to pass the template as parameter to your plugin:
{func template=$smarty.template}
another way would be a prefilter that prepend
{assign var=template value=$smarty.template} to each template.
then you can access $smarty->get_template_vars('template') from within your plugin-function. |
|
Back to top |
|
SunFire Smarty n00b
Joined: 19 Sep 2003 Posts: 4
|
Posted: Sun Feb 06, 2005 8:19 pm Post subject: |
|
|
messju wrote: | {$smarty.template} is not available from the compiled template or from a plugin.
the easiest solution is to pass the template as parameter to your plugin:
{func template=$smarty.template}
another way would be a prefilter that prepend
{assign var=template value=$smarty.template} to each template.
then you can access $smarty->get_template_vars('template') from within your plugin-function. |
This is how I was working around it until now. Well guess I have to stick with it then. Thank you for the quick response! |
|
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
|