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

Getting current template path

 
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
shnapoo
Smarty Rookie


Joined: 26 May 2010
Posts: 6

PostPosted: Sun Jul 18, 2010 9:29 am    Post subject: Getting current template path Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Jul 18, 2010 1:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
shnapoo
Smarty Rookie


Joined: 26 May 2010
Posts: 6

PostPosted: Sun Jul 18, 2010 2:51 pm    Post subject: Reply with quote

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