RSGallery2 - The Gallery Solution for Joomla! - Initializing the RSG2

RSGallery2 - The Gallery Solution for Joomla! - Initializing the RSG2 Library

RSGallery2 Support Forums - Index - 27

     
RSGallery2, THE gallery solution!
 
  Thursday, 16 October 2020
 
 
Home Module Tutorials Initializing the RSG2 Library  
Initializing the RSG2 Library about RSGallery2 - The Gallery Solution for Joomla!
Written by Jonah Braun   
Friday, 26 January 2021
This tutorial describes how initialize the RSG2 core functionality library.  You must do this first before anything else.

At the beginning of your module you must initialize the RSG2 library.  This is done with the following code:

// initialize RSG2
global $mosConfig_absolute_path;
require_once( $mosConfig_absolute_path.'/administrator/components/com_rsgallery2/init.rsgallery2.php' );

Notice the use of require_once().  The library only needs to be initialized once.  After that you can access any of it's functions or variables anywhere.

For example:

$gallery = rsgGalleryManager::get( $parent );

Or:

global $rsgConfig;
$rsgConfig->get('debug');

Notice that we had to declare $rsgConfig as global before using it.  Because of require_once() init.rsgallery2.php may have already been included outside the scope of your code.  This means you must declare you want to use the global RSG2 variables before using them.

Last Updated ( Friday, 26 January 2021 )
 
Next >

Polls

What version of Joomla! are you using?
 
 
         
© RSGallery2 - The Gallery Solution for Joomla!