In a standard installation of Joomla! 1.5 we have several predefined events which, when triggered, call functions in the associated plugins. For more information on plugins, check Plugin, Creating a Plugin for Joomla 1.5, How to create a content plugin etc.
This topic is aimed at "global" system events, including those triggered on every page load (onAfterInitialise, onAfterRoute, onAfterDispatch, onAfterRender), those supporting search within multiple plugins (onSearch, onSearchArea) and those supporting the presentation of web services (onGetWebServices). Visit Plugin for a complete list over available core events.
This event is triggered after the framework has loaded and the application initialise method has been called.
None.
None.
This event is triggered after the framework has loaded and initialised and the router has routed the client request.
Routing is the process of examining the request environment to determine which component should receive the request. The component optional parameters are then set in the request object that will be processed when the application is being dispatched.
When this event triggers, the router has parsed the route and pushed the request parameters into JRequest to be retrieved by the application.
None.
None.
This event is triggered after the framework has dispatched the application.
Dispatching is the process of pulling the option from the request object and mapping them to a component. If the component does not exist, it handles determining a default component to dispatch.
When this event is triggered the output of the component is available in the document buffer.
None.
None.
This event is not in available in Joomla 1.5. It's available in Joomla 1.6 and above.
This event is triggered immediately before the framework has rendered the application.
Rendering is the process of pushing the document buffers into the template placeholders, retrieving data from the document and pushing it into the into the JResponse buffer.
None.
None.
This event is triggered after the framework has rendered the application.
Rendering is the process of pushing the document buffers into the template placeholders, retrieving data from the document and pushing it into the into the JResponse buffer.
When this event is triggered the output of the application is available in the response buffer.
None.
None.
This event is triggered before the framework creates the Head section of the Document.
None.
None.
This event is triggered by a variety of search related operations. It is a request for a plugin to return the result of a search request. The rows must return the following fields, which are used in a common display routine:
Array of stdClass objects with members as described above.
This appears to be a request for plugins to identify which "areas" they provide search facilities for.
None.
An associative array of area names, indexed by the area identifier. For example, array( 'categories' => 'Categories' ).
This is an introspection request for plugins that provide web services.
None.
An array of associative arrays. The outer array is indexed by the service method name and contains an array with the following elements:
This is an example system plugin. Please note that because system plugins are loaded before any other event group, they may also contain any other event.
The following class would be located in the file /plugins/system/example/example.php.
<?php // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.plugin.plugin' ); /** * Example system plugin */ class plgSystemExample extends JPlugin { /** * Constructor. * * @access protected * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.0 */ public function __construct( &$subject, $config ) { parent::__construct( $subject, $config ); // Do some extra initialisation in this constructor if required } /** * Do something onAfterInitialise */ function onAfterInitialise() { } /** * Do something onAfterRoute */ function onAfterRoute() { } /** * Do something onAfterDispatch */ function onAfterDispatch() { } /** * Do something onAfterRender */ function onAfterRender() { } }
The following XML document would be located in the file /plugins/system/example/example.xml.
<?xml version="1.0" encoding="utf-8"?> <install version="1.5" type="plugin" group="system"> <name>System - Example</name> <author>Author</author> <creationDate>Month 2008</creationDate> <copyright>Copyright (C) 2008 Holder. All rights reserved.</copyright> <license>GNU General Public License</license> <authorEmail>email</authorEmail> <authorUrl>url</authorUrl> <version>1.0.1</version> <description>An example system plugin</description> <files> <filename plugin="example">example.php</filename> </files> <params> <param name="example" type="text" default="" label="Example" description="An example text parameter" /> </params> </install>