Jump to content

How to change variable in a class from outside the class


ballhogjoni

Recommended Posts

I have the below code and I want to change the specific variables based on the if else clause. How would I do this? It seems like the code below won't work and I can't add the if else in the class unless its in a function.

 

if($_GET['ac'] == 'Areas'){
  $table_name = 'Area';
  $table_id = 'area_id';
  $col = array(
      'area_id' => array(
          'type'  => 'int',
          'size'  => 11,
          'qf_type'  => 'hidden'
      ),

      'area'  => array(
          'type'  => 'varchar',
          'size'  => 255,
	  //form element definition
          'require'   => true
      ),
      
      'page' => array(
        'type'    => 'varchar',
        'size'    => 255,
        'require' => true,
        'qf_vals' => array(
          'hotels'  => 'Hotels',
          'clubs'  => 'Clubs',
          'shows' => 'Shows',
          'dining' => 'Dining',
	  'tours'  => 'Tours',
	  'golf'   => 'Golf'
        )
      )
  );
}else{
  $table_name = 'Categories';
  $table_id = 'category_id';
  $col = array(
      'category_id' => array(
          'type'  => 'int',
          'size'  => 11,
          'qf_type'  => 'hidden'
      ),

      'category_name'  => array(
          'type'  => 'varchar',
          'size'  => 255,
	  //form element definition
          'require'   => true
      ),
      
      'page' => array(
        'type'    => 'varchar',
        'size'    => 255,
        'require' => true,
        'qf_vals' => array(
          'shows'  => 'Shows',
          'clubs'  => 'Clubs',
          'hotels' => 'Hotels',
          'dining' => 'Dining',
	  'tours'  => 'Tours',
	  'golf'   => 'Golf'
        )
      )
  );
}
/**
*
* Hotel
*
* This is the top level for path hierarchey
*
* @subpackage  SubPackage
* @see      FR_Object_DB_Table
*/
class Category extends FR_Object_DB_Table {
  /**
   * Table name
   * @var    mixed
   * @access  public
   */
  var $table_name;

  /**
   * Hotel id field
   * @var    mixed
   * @access  public
   */
  var $table_id;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.