Creating an XML gallery template.
Written by Jonah Braun   
Wednesday, 21 March 2021
So you have a custom slideshow and want to integrate it with RSGallery2?  RSG2 will produce any type of XML file you want.  Creating a template to control this is easy if you know PHP.

XML templates are kept in /components/com_rsgallery2/xml_templates/   First open generic.php.  This is the super template that all other templates inherit.  Now open todd_dominey.php.  Your template class can be structured similar to this.  Note that the class extends the generic template class rsgXmlGalleryTemplate_generic.  The functions of your template are called in this order:

__contstructor( $gallery );  The object is created with the rsgGallery object that should be shown.  rsgXmlGalleryTemplate_generic assigns this to $this->gallery.  You can access it from there.

prepare()  You should prepare all your output in this function.  Refer to the module tutorials on RSGallery2 libraries that are available to you.  It is easy to extract and output any gallery and image related information.  rsgXmlGalleryTemplate_generic has variable $this->output that you can use to store output.

printHead()  This prints the XML head.  You shouldn't need to extend this function.

printGallery()  rsgXmlGalleryTemplate_generic echos $this->output here.  If you did not store your output in $this->output you will need to extend this function.

The getName() function is currently only used for debugging purposes. 

Check the Developer's Lobby forum if you need help. 

Last Updated ( Wednesday, 21 March 2021 )