Plugin Best Practices

Plugins should extend org.mangoblog.plugins.BasePlugin. Extending from this component will give you all the required functions for a plugin and a lot of utilities to facilitate managing preferences. If you are targetting ColdFusion 7, then you can either require the user to add a mapping called "org/mangoblog" to point to the components folder or simply copy the current BasePlugin to your plugin folder and extend "BasePlugin" instead. This has the disadvantage that your base plugin will get out of date.

Plugins should not hardcode paths and should not assume it is placed in any specific folder. Remember that the plugins and components can be moved out of the webroot and its location set in the config file.

Plugins should not use tags to output information. This is not only a matter of style (tags should only be used for layout), but if you do so, your plugin may not work. As noted above, the plugins can be located anywhere, and there is no guarantee the tags will be located in any specific absolute or relative path from the plugins folder.

Because plugins are components, they should not use (or try to minimize) the access to server, application, request or session variables. Instead, they should try to get all the information from the current event and store variables in its own variables scope. The use of the application scope is not needed at all, since a plugin will live the same amount of time as the application itself, so any variable can be instantiated within the plugin and it will persist while the application lives.