JPhoto Plugin Developer Documentation
Plugins can be created to change the display of a module or a gallery view. Please see the hs_default plugin, this plugin can be download from our downloads section. We will use this plugin as a base example for this tutorial.
You must have the same structure for this plugin as you would for a Joomla plugin.
Plugins must be of group jphoto. This is something you need to write on the installation xml. Here is an example:
<install version="1.5" type="plugin" group="jphoto" method="upgrade">
In the plugin file you must have a class with the name of the plugin this class needs to have a method of display_gallery( &$view ) or a method display_module ( $list, &$mparams, $vars ). Here is an example:
class plgJPhotoHS_Default extends JPlugin
{
/**
* @param view object The view that calls in this plugin
* @return bool Tells view to return so that the rest of the view is not executed
**/
function display_gallery( &$view )
{
// This return tells the gallery if it should keep on displaying the normal
// view or should it return and not display the rest of the file.
return true;
}
/**
* @param list Object Contains the list of images to display
* @param params Object Contains all module parameters
* @param vars Array Contains module options and settings
* @return Array First param tell module to not display default content
* Second param is the list of default variables
**/
function display_module( $list, &$mparams, $vars )
{
// These variables are passed so that you can use them on your plugin, or you can
// just modify them and return them to modify the default view of the module
extract( $vars );
$_vars = array();
foreach( $vars as $key => $val ){
$_vars[$key] = ${$key};
}
// The first value tells the module if it should return and not display the rest of
// the file, or if false it will display the rest of the module, the second value are
// the variables that are passed to the module.
return array( true, $_vars );
}
}
From here you can do what you want with the data that is passed to the methods, you can modify it and return it, or you can have a custom display of it.
For any further questions, contact us at http://support.corephp.com/


