[eluser]ZeroLag[/eluser]
This has got to be a really simple question for most of you:
Can I use a variable that I set in the constructor of my controller?
/The constructor for the Management controller
Code:
function Management()
{
parent::Controller();
$data['doctype'] = $this->load->view('shared/doctype', '', TRUE);
$data['meta'] = $this->load->view('shared/meta', '', TRUE);
$data['nav_bar'] = $this->load->view('main_site/nav_bar', '', TRUE);
$data['nav_box'] = $this->load->view('main_site/nav_box', '', TRUE);
$data['footer'] = $this->load->view('shared/footer', '', TRUE);
.
.
.
}
And the index function
Code:
function index()
{
$this->load->view('management/management_index', $data);
}
This works fine when I put the code from the constructor into the individual functions, but I'm going to be using the code in every function of this controller, so I was trying to only type this code once. When I put it in the constructor like above, I get:
Quote:Fatal error: Access to undeclared static property: Controller::$data in D:\inetpub\...\system\application\controllers\management.php on line 73
I'm new to OOP, can someone help me out?
Thanks,
Steve