Plugins

Plugins work almost identically to Helpers. The main difference is that a plugin usually provides a single handler, whereas a Helper is usually a collection of handlers. Helpers are also considered a part of the core system; plugins are intended to be created and shared by the users.

Plugins should be saved to your system/plugins directory or you can create a folder called plugins inside your application folder and store them there. revIgniter will look first in your system/application/plugins directory. If the directory does not exist or the specified plugin is not located there revIgniter will instead look in your global system/plugins folder.

Loading a Plugin

Loading a plugin file is quite simple using the following handler:

rigLoadPlugin "name"

Where name is the file name of the plugin, without the .lc file extension or the "Pi" part.

For example, to load the footerlinks plugin, which is named footerlinksPi.lc, you will do this:

rigLoadPlugin "footerlinks"

A plugin can be loaded anywhere within your controller handlers, as long as you load it before you use it.

Note: The Plugin loading handler above does not return a result value, so don't try to assign the result to a variable. Just use it as shown.

Loading Multiple Plugins

If you need to load more than one plugin you can specify them in a comma separated list, like this:

put "plugin1,plugin2,plugin3" into tPlugins
rigLoadPlugin tPlugins

Or you can specify them in an array, like this:

split tPlugins using comma
rigLoadPlugin tPlugins

Auto-loading Plugins

If you find that you need a particular plugin globally throughout your application, you can tell revIgniter to auto-load it during system initialization. This is done by opening the application/config/autoload.lc file and adding the plugin to the autoload array.