Thoughts on how plugins are loaded
Posted: Tue Apr 19, 2005 2:40 am
I could be wrong about a couple things here, let me know if I am.
The default way smarty handles plugins, is that they are loaded only if they are used in the template. CMS however, loads all the plugins, used or not. This could cause some serious speed issues if you developed numerous special plugins.
To solve this problem, several things could be done, but here is one idea. Add the plugin directory to the $smarty->plugins_dir array. This would require, however, that all the plugin function names be renamed from smarty_cms_function_* to smarty_function_* as the "smarty_function" is hard coded into the Smarty compiler class (line 781, Smarty_Compiler.class.php) To work around this, it would probably be best to override the _compile_custom_tag() in one of the smarty extension classes, as long as the smarty source for this function is monitored.
Hope this makes some sense.
The default way smarty handles plugins, is that they are loaded only if they are used in the template. CMS however, loads all the plugins, used or not. This could cause some serious speed issues if you developed numerous special plugins.
To solve this problem, several things could be done, but here is one idea. Add the plugin directory to the $smarty->plugins_dir array. This would require, however, that all the plugin function names be renamed from smarty_cms_function_* to smarty_function_* as the "smarty_function" is hard coded into the Smarty compiler class (line 781, Smarty_Compiler.class.php) To work around this, it would probably be best to override the _compile_custom_tag() in one of the smarty extension classes, as long as the smarty source for this function is monitored.
Hope this makes some sense.