* User Info

Welcome, Guest. Please login or register.

* Recent Posts

Can't get RSG "Show My Galleries" to work by Dampfnudel
[February 25, 2019, 11:01:55 AM]

Change the order of uploaded images in the gallery by whazzup
[February 19, 2019, 10:37:29 PM]

Upload timeout for large galleries (500 images each) by whazzup
[February 11, 2019, 10:07:25 PM]

Greetings from Ronald Smit by whazzup
[January 06, 2019, 03:39:22 PM]

Pluign and module by whazzup
[June 08, 2018, 11:57:13 PM]

Version 4.4.1 released by whazzup
[May 31, 2018, 04:31:16 PM]

search.html.php refer to rsgsearch.css with a wrong path by whazzup
[January 13, 2018, 08:12:04 PM]

Slow Gallery with many Photos by whazzup
[September 22, 2017, 09:22:33 AM]

Author Topic: how a rsg2 template is structured.  (Read 9674 times)

Offline Jonah

  • Retired from Dev Team
  • Hero Member
  • ****
  • Posts: 1.412
how a rsg2 template is structured.
« on: May 28, 2007, 05:40:31 PM »
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.
Due to time constraints, I have taken a step back from RSGallery2.  In the event of an emergency, you will need to PM me.