Its actually quite easy once you wrap your head around the problem. I've just finished writing one in C#, but the concept is portable.
First thing you need to know is what goes in the plugin and what goes in the framework. 1. The plugin should not know anything about the framework that it runs in 2. Every plugin needs to have a set of defined interfaces that the framework expects to be there in order to work correctly 3. The framework only needs to load and unload the plugins and handle the common ground between all the plugins That may sound vague, but its actually quite simple. I would use OO to do it, but you can change it. // Common interfaces required by framework // I've kept it simple because I dont know what you want the plugin to do class IPlugin { var $Name = 'Plugin'; function Run () { // Start the plugin running } } // this is our plugin called Example class Example extends IPlugin { // code to do all plugin stuff } // Main framework class Framework { function Framework () { // locate all plugins on the system (eg in a directory called plugins with a common naming convention) // psuedo code foreach (plugin in plugindir) { echo plugin->Name; plugin->Run(); } } } It's not the greatest example, but you can email me for some more detail on the topic. Some additions to the code would be to check that the plugin actually extends the IPlugin class so that you know it is a valid plugin. And normally you would only run the plugin when someone clicks on a particular link for example. Think of the framework as an empty shell that has the sole purpose of activating and deactivating the plugins. The plugins just do their thing independant of the framework/shell, but are executed inside of it. For example, a user or security plugin inside an admin framework for a cms application. The hardest part is defining a plugin interface generic enough to suit all plugins. The framework/shell should not know anything in particular about the individual plugins other than what is defined in the IPlugin class. I hope this helps you get started. Email me if you need more help on it. Tim "Justin French" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hi all, I'm struggling to find any tutorials or 'thought starters' on how I can incorporate script-level plug-ins into a PHP application. Another way, can I see some examples of how my application framework can provide an API for modular, add-on code? I understand that there would definitely not be just one solution... in fact, it may be the case that each solution needs to be tailored to a specific problem, but I'd like some 'inspiration' to develop my own code base. Any help / ideas / links would be great. Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php