This page is up-to-date for Elgg 1.8.
Elgg offers a facility to manage your plugin pages via a page handler, enabling custom urls like
http://yoursite/your_plugin/section. To add a page handler to a plugin, a handler function needs to be registered in the plugin's
start.php file with
The plugin's page handler is passed a single parameter: an array containing the sections of the URL exploded by '/'. With this information the handler will be able to apply any logic necessary, for example loading the appropriate view and returning its contents.
Pages in plugins should be served only through page handlers, stored in pages/ of your plugin's directory and do not need to include or require Elgg's engine/start.php file. The purpose of these files are to knit together output from different views to form the page that the user sees. The program flow is something like this:
array('section', 'entity')as the first argument.
There is no syntax enforced on the URLs, but Elgg's coding standards suggests a certain format.
In Elgg 1.7 and prior, a
/pg/ prefix was required on all urls in order to be passed through the page handler. So instead of
/plugin_name/section/entity, the url would be
elgg_ prefix was added to the registration function in 1.8. If developing for 1.7 or prior, you'll need to use