<! add variable to global $gCms or use $_SESSION

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
mikemcvey
Forum Members
Forum Members
Posts: 61
Joined: Tue May 02, 2006 4:08 am

<! add variable to global $gCms or use $_SESSION

Post by mikemcvey »

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..
  • 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'];
      }
Post Reply

Return to “Modules/Add-Ons”