<! add variable to global $gCms or use $_SESSION
Posted: Mon Feb 25, 2008 3:37 am
hi,
I am using the Banners module and have become frustrated that it doesn't remember what category you are in when you edit banners etc.
I have made a hack by adding the $curcategory to the $SESSION...
Is this the way to do it? OR can I add it easily to the $gCms Object.
I am never sure wether to use one or the other... or which is correct...
If anyone wants top edit there banner module to add the hack the code is below..
I am using the Banners module and have become frustrated that it doesn't remember what category you are in when you edit banners etc.
I have made a hack by adding the $curcategory to the $SESSION...
Is this the way to do it? OR can I add it easily to the $gCms Object.
I am never sure wether to use one or the other... or which is correct...
If anyone wants top edit there banner module to add the hack the code is below..
- changes in function.DisplayBannersTab.php
Code: Select all
function _DisplayBannersTab( &$module, $id, &$params, $returnid )
{
global $gCms;
// print_r($gCms);
// get the current category for the filter
$curcategory = (isset($params['curcategory']) ? $params['curcategory'] : $_SESSION['cur_banner']);
if( isset($params['submitcategory']) ) {
$curcategory = (isset ($params['input_category']) ? $params['input_category'] :
'');
// hack to keep track of last category..
$_SESSION['cur_banner'] = $params['input_category'];
}