Hi,
I'm trying to do a 'get' query inside the __construct of my controller to get some users information. I have a general 'core' layout which needs this information. When trying to do a print_r($data) inside my core view, it returns blank. Could someone point out what im doing wrong?
PHP Code:
class Staff extends MY_Controller {
/*******************************************************
* CONSTRUCT
*******************************************************/
public function __construct()
{
parent::__construct();
$this->load->model('staff_model');
$data['session'] = $this->get_session_information();
print_r($data['session']); // this returns my data as expected
}
However when in my view.... nothing is returned. I'm assuming it is because $data is not passed into the view at this point in the construct. I dont want it to pass the view at this stage. I therfore think that data needs to somehow be made public, so it can be built up inside the controller at any stage. Could someone clarify what i'm doing incorrectly?
PHP Code:
<pre>
<?php print_r($session); ?>
<?php print_r($data); ?>
</pre>
Thanks,
MoFish