Repository navigation
PluginsDev
Info on using a plugin here.
Plugins can be a normal plugin or an autoload plugin or both.
Plugins are stored in ./evn_site/_plugins/, so a plugin named sampleplugin is contained in ./evn_site/_plugins/sampleplugin/.
- If needed to autoload, a plugin must have an
_autoload.phpfile - If needed as a normal plugin, it must have a
main.phpfile -
[optional]A configuration file named_config.php(more info...) -
[optional]An util functions file named_util.php(more info...)
Normal plugins are activated only when the assigned path is loaded. It's also allowed to call a subpath of the given path.
In the main.php file you must define a class, extending the EvnPlugin abstract class setting the name as your plugin name (all lowercase!).
You must define at least the activate() function that returns the content your plugin want to publish as the content of the given page.
Example from the helloworld plugin.
class helloworld extends EvnPlugin{
function activate()
{
set_template_var('title',' :: This is a Demo Plugin!');
return '<h2>A Demo Plugin</h2><p>Hello world!!<br/>I\'m a
<a href="http://code.google.com/p/evinrude/wiki/Plugins">plugin</a>
activated on the <code>'.$this->incoming_path.'</code> path!!</p>';
}
}
Autoload plugins are always executed when a page is loaded.
In the _autoload.php file you must define a class, extending the EvnAutoloadPlugin abstract class setting the name as your plugin name (all lowercase!) and adding _auto after it.
You must define at least the execute($args=array()) function that could return the content your plugin want to publish, or an empty string if your plugin acts silently.
Example from the helloworld plugin.
class helloworld_auto extends EvnAutoloadPlugin{
function execute($args=array())
{
return '<div id="autop">Hello world!! I\'m an autoloaded
<a href="http://code.google.com/p/evinrude/wiki/Plugins">plugin</a>!!</div>';
}
}
A plugin can also use ajax calls, defining an ajax function: see the helloworld plugin for an example. More info to come.