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

2.6.2 _get_plugin_filepath

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
Cloggs
Smarty Rookie


Joined: 16 May 2003
Posts: 8
Location: United Kingdom

PostPosted: Sat Mar 06, 2004 5:55 am    Post subject: 2.6.2 _get_plugin_filepath Reply with quote

I use the _get_plugin_filepath in my plugins to pull in other plugins using the same mechanism the standard Smarty modifier date_format uses.

Since installing 2.6.2 I have run in a referencing problem and now need to use $smarty->call _get_plugin_filepath when the plugin is called from a compiled template and $this->call _get_plugin_filepath when the plugin is called by the Smarty compiler.

Appears that when the compiler is called the $smarty variable is not available to the custom plugin but $this is. This is easily demonstrated by using the force_compile property and using the isset() function.
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Thu Mar 11, 2004 6:24 pm    Post subject: Reply with quote

if your plugin is a modifier, then it's always $smarty->_get_plugin_filepath() (that changed from $this to $smarty in Smarty 2.6.0)

but modifier's are never included by the compiler, so it's *always* $smarty and should be no problem.

if your plugin is anything else than a modifier, then you get a reference to $smarty as function-parameter. in this case you should require the other plugin *inside* the plugin-function, not outside. (like function.html_select_date.php does it, for example).
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Cloggs
Smarty Rookie


Joined: 16 May 2003
Posts: 8
Location: United Kingdom

PostPosted: Sun Mar 14, 2004 6:30 pm    Post subject: Thanks Reply with quote

Thanks, changed the require_once to inside the function thus removing the need for my workaround.

Maybe is would be useful to add your guidance to the manual page 'http://smarty.php.net/manual/en/plugins.writing.php'
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 -> Bugs 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