Initializing the RSG2 Library
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 );


global $rsgConfig;

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 )