Plugins Documentation
Overview
Plugins are encapsulated pieces of functionality containing both actions, templates and even layouts in a single directory. They can be easily shared and reused across multiple projects.
Structure of a Plugin
Each Plugin should have the following structure:
/var/www/project-root/plugin-name/
|-- actions/
| |-- index.php
| |-- action1.php
| |-- action2.php
|-- views/
| |-- index.html
| |-- action1.html
| |-- action2.html
|-- layouts/
| |-- layout1.html
URL Structure
When a plugin is installed, its actions are accessible via URLs prefixed with the plugin name. For example, if
a plugin named blog has an action called view-post, it would be accessible at:
http://yourdomain.com/blog/view-post
The default action (and view of the plugin) should be named index.php for actions and
index.html for views.
The default action is accessible at the root URL of the plugin. e.g.
http://yourdomain.com/plugin-name
Overwriting Plugin Actions and Views
Plugin files can be overwritten by the files in the main project directories. This way you can overwrite the actions but leave the views served from the plugin and vice versa - leave actions from the plugin but change the views for that specific project.
Example of Overwriting:
/var/www/project-root/
|-- blog/ # Main plugin directory
| |-- actions/
| |-- index.php
| |-- article.php
| |-- views/
| |-- index.html
| |-- article.html
|-- actions/ # Main project actions directory
| |-- blog/ # Overwriting the blog plugin actions
| |-- article.php # This action will be used instead of the one in the plugin
|-- views/ # Main project views directory
| |-- blog/ # Overwriting the blog plugin views
| |-- index.html # This view will be used instead of the one in the plugin
Templates
When using includes in the plugin, use the following path:
<!--include:/plugin-name/sections/filename.html-->
This will reference the view in the plugin views folder or the file user would be:
/var/www/project-root/plugin-name/views/sections/filename.html
Including Plugin Templates into the main project
You can also include the plugin templates into the main project templates using the following:
<!--include://plugin-name//sections/filename.html-->
This will reference the view in the plugin views folder or the file user would be:
/var/www/project-root/plugin-name/views/sections/filename.html
This is useful in cases where part of the plugin is required to be included on the project. For example contact plugin could provide the contact form template which can be included into the project page.
Layouts
When using layouts in the plugin, use the following path:
<!--layout:/plugin-name/layoutname.html-->
This will reference the layout in the plugin layouts folder or the file user would be:
/var/www/project-root/plugin-name/layouts/layoutname.html
Available Plugins
This is a list of the available plugins.