![]() |
Plugin Handling Class - Extends the CI_Hooks Class - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Plugin Handling Class - Extends the CI_Hooks Class (/showthread.php?tid=10594) |
Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-30-2008 [eluser]simshaun[/eluser] [quote author="Xeoncross" date="1230702619"]Actually, it doesn't get anymore plug-in-play than the way CI does it. I used to do it like what you did, but having to change lines by hunting down files and removing/adding filters is really bad practice. Config settings should go in config files (like hooks) that way you can manage all hooks from one place. Also, running code from a plugin/hook/file (like grabbing the CI instance to set a plugins) is really bad form and is MUCH slower than just using hooks.php because you have to load ALL files just to see if they register some hook![/quote] I understand what you mean in that last sentence, and I've partially handled the performance issue (loading every plugin just to see if they register a hook). Any plugins added to my plugins directory have to be activated through the admin interface. This is the only time that every single plugin is loaded. Each plugin's filename and meta information is stored in a database. Once activated, a column in the db is set to "1" instead of "0". When you try to load a web page, CI queries the database and only loads those plugins which have been activated. ------------------------------- The pros of my method: * A person does not have to touch any code * - config/routes.php does not have to be touched. * - Simply put the plugin in the folder and activate it through the admin. The cons of my method: * Every 'activated' file must be loaded to register the hooks, rather than having the hooks already defined in hooks.php and loading the file only when needed. ------------------------------- Oh, and my $config settings will be going in config/custom_config.php and auto-loaded by CI. Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-30-2008 [eluser]Xeoncross[/eluser] Yep, that is how I first did it for my blog but then I saw that it isn't worth it as this is a PHP framework and we are SUPPOSED to touch config files. People don't login and activate/disable plugins everyday - you only do that when you first setup a site. So having all the waste and haste of managing plugins from files plus the database just isn't worth it. Most systems will only need 1-7 anyway. Something to filter comments, maybe a mailer on a certain error event and that is it. The loss of speed isn't worth the convenience of setting plugins from an admin area - (unless you are wordpress and your blog owners don't even know what PHP code is) Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-30-2008 [eluser]simshaun[/eluser] You hit the nail on the head with that last sentence. Without going into too many details, my CMS will have (is required) to be as simple as possible to extend (much like Wordpress...) in the future. If it were only me that would be messing with the CMS, I wouldn't care about ease-of-use. Unfortunately, this is not the case. Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-30-2008 [eluser]Xeoncross[/eluser] [quote author="simshaun" date="1230705285"]my CMS will have (is required) to be as simple as possible to extend (much like Wordpress...) in the future.[/quote] If that is the case then code away my friend. - but why would people download a CMS built on CodeIgniter if all they really want is something simple to use like wordpress? I think you are about to experience a clash of worlds... ;-) Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-30-2008 [eluser]simshaun[/eluser] I'm not here for an argument, but people won't be downloading the CMS. I work for a web dev company. We'll sell this CMS as an install-it-yourself package. We'll sell plugins separately.. they must be able to install them without touching the code. For more money, we'll custom build whatever they want. There are a lot of other "points" in the plan, but that's the gist of it. Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-30-2008 [eluser]Xeoncross[/eluser] There you go, that is the only (and perfect too!) time for what you are suggesting. Good luck. I just wanted to warn you encase you were planning on trying to compete on the free, wordpress simpleton market with something like a PHP framework. Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-31-2008 [eluser]Dready[/eluser] great contribution, so sad you didn't release any package on your google site ! Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-31-2008 [eluser]Xeoncross[/eluser] What? Do you mean it isn't a zip file? Because you can use SVN to download it from here: code.google.com/p/codeigniter-extrahooks Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-31-2008 [eluser]simshaun[/eluser] A lot of people (sadly) don't know how to use SVN. It might be worth making it a packaged zip file. Plugin Handling Class - Extends the CI_Hooks Class - El Forum - 12-31-2008 [eluser]Xeoncross[/eluser] True, they need to download http://tortoisesvn.net/ Also, you don't need SVN to download the files - just browse to the class and click the "view raw file" button and save it. Copy-and-paste - it's how we all started no? |