Re: [SMARTY] multiple plugin_dirs
| From: | Monte Ohrt | Date: | Wed, 26 Jun 2002 16:34:20 +0000 |
| Subject: | Re: [SMARTY] multiple plugin_dirs | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5042@lists.php.net to get a copy of this message | ||
Good things to be concerned about. One thing to keep in mind:
*) The closer to the top of the plugin array your functions lie, the quicker they will be found. Keep the common ones there.
*) if the PHP include_path is needed, this will take a little longer. Try to supply full pathnames, or relative to your cwd or SMARTY_DIR.
*) once a plugin is found the location is retained, so multiple calls to the same function to not induce multiple searches.
*) Currently, each entry in the $plugins_dir array is searched in its entirety. Maybe we should test them all first for local path, then go back and test them all with the PHP include_path if it still isn't found? This would be a bit more efficient, but I'm not sure it is the expected behavior.
Monte
Gerard Samuel wrote:
Again, please forgive me. Im still new here, and I haven't looked through your code. The only thing that jumped out at me, is the potential of a high miss rate. Im concerned how it would perform, performance wise. But I guess we all wouldn't know with out some testing :) Ill see what I can do to try it out... Monte Ohrt wrote:-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.In the case you have plugins for a specific purpose that you don't want in the main plugin directory. Also if you keep the default Smarty plugins in one directory and all of your custom plugins in another, they may be easier to maintain that way (You don't mess with the original distribution of Smarty.) Gerard Samuel wrote:What brought about this idea?? I dont really understand the need for multiple plugin dirs.... Monte Ohrt wrote:I have committed changes (with help from Andreas Kossmeier) to allow $plugins_dir to be an array of directories. Please help test this, try every type of plugin and different combinations of plugin_dirs! It works like so: loop through plugin dirs { try to find $plugin_dir . $plugin_file if not found and is a relative path { try to find SMARTY_DIR . $plugin_dir . $plugin_file if not found {Try finding $plugin_dir.$plugin_file from PHP include_path} } } Does this sound good? Also, if any of your plugins used $this->plugin_dir, they will need to be updated! see the functions in the repository for an example. Monte