• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Undefined variable: data

#1
[eluser]solid9[/eluser]
All I just want is to declare the $data as public and as an array variable.
So that I can access it in every function of the class.
But it failed.

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$data = array();

class Main extends CI_Controller {

public function __construct() {
  parent::__construct();

  $this->load->helper('form');
  $this->load->helper('html');
  $this->load->helper('url');    
  $this->load->library('ion_auth');
  $this->load->library('session');
  $this->load->library('form_validation');
  $this->load->database();

  //$this->load->model('prod_m');
}


function login()
{
  $this->$data['header'] = $this->load->view('header', null, TRUE);
  
  $this->load->view('front_page', $this->data);
}

}
/* End of file main.php */
/* Location: ./application/controllers/main.php */

any help please.

Thanks in advanced

#2
[eluser]Jason Stanley[/eluser]
Quote:All I just want is to declare the $data as public and as an array variable.

Then do that?

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

public $data = array();

public function __construct() {

#3
[eluser]solid9[/eluser]
@jason

sorry for this easy question,

My study on CodeIgniter is on and off.

Thanks for the help.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.