Thoughts on how plugins are loaded

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
SRTech

Thoughts on how plugins are loaded

Post by SRTech »

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.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Thoughts on how plugins are loaded

Post by Ted »

Well, there is one main reason why CMS does it's own plugin loading.  Cacheing.  I wanted to insure that all of the CMS plugins didn't cache (particularly cms_module) as it would cause some real issues with the dynamic nature of what we're doing.

If you know enough about the internals of Smarty and have a good way to solve this fact, I'm all for it.  That was a hack I did somewhere around version 0.3/0.4, and I'm sure there is a better way now.
SRTech

Re: Thoughts on how plugins are loaded

Post by SRTech »

Have a couple ideas for this. Will try some things and report back later.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Thoughts on how plugins are loaded

Post by Ted »

Ok, cool.  Performance is always a good thing.

Don't forget about user defined tags either.  They're stored in the database and converted to smarty plugins on the fly...
Post Reply

Return to “Developers Discussion”