Developers corner > Developer Lobby

how a rsg2 template is structured.


template files go in a folder in templates.  the template folder name is also it's technical name and is used to select the template at runtime.

index.php is structured sort of similar to the Joomla! templates.  index.php is responsible for setting things up, including any libraries, etc.  it's also where the rsg2 equivalent of Joomla! modules are shown; menus, random or latest images that you want to show on the main page, etc.

display.class.php should contain your templates display class.  the class name should be prefixed with rsgDisplay_ and end with your templates technical name (the template folder name).  example: rsgDisplay_myTemplate

your template class must extend rsgDisplay even if by extending a different class that extends rsgDisplay.  you can reuse existing functionality by extending a different template's rsgDisplay.

rsgDisplay->mainPage() is responsible for switching through the request variable $page and call various rsgDisplay functions which display html and generally provide the frontend of RSGallery2.

the variable rsgDisplay->gallery contains a rsgGallery object representing the gallery whose ID has been specified by the request vars $gid (preferred) or $catid (depreciated).  you can refer to this variable within a rsgGallery function as $this->gallery.  an example retrieving an array of images in a gallery: $this->gallery->getItems();.

comments or questions are welcome.

future features for the rsg2 templating system include:
 - user parameters loaded from a templates xml file.
 - break out html display tags from display.class.php to separate files.
 - have template files editable from the template manager.
 - ability to assign templates to galleries.


[0] Message Index

Go to full version