Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

howto access the name of current template in a plugin?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
SunFire
Smarty n00b


Joined: 19 Sep 2003
Posts: 4

PostPosted: Sun Feb 06, 2005 5:15 am    Post subject: howto access the name of current template in a plugin? Reply with quote

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. Sad

Thnx in advance!
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sun Feb 06, 2005 1:13 pm    Post subject: Reply with quote

{$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
View user's profile Send private message Send e-mail Visit poster's website
SunFire
Smarty n00b


Joined: 19 Sep 2003
Posts: 4

PostPosted: Sun Feb 06, 2005 8:19 pm    Post subject: Reply with quote

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. Sad Well guess I have to stick with it then. Thank you for the quick response!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP