|
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 |
Cloggs Smarty Rookie
Joined: 16 May 2003 Posts: 8 Location: United Kingdom
|
Posted: Sat Mar 06, 2004 5:55 am Post subject: 2.6.2 _get_plugin_filepath |
|
|
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 |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Mar 11, 2004 6:24 pm Post subject: |
|
|
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 |
|
Cloggs Smarty Rookie
Joined: 16 May 2003 Posts: 8 Location: United Kingdom
|
Posted: Sun Mar 14, 2004 6:30 pm Post subject: Thanks |
|
|
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 |
|
|
|
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
|