__construct passing data? |
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 { 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> Thanks, MoFish
$data is a local variable of your constructor. You need to make a member variable of your controller class if you want to use it somewhere else in other functions of your controller.
PHP Code: class Staff extends MY_Controller { |
Welcome Guest, Not a member yet? Register Sign In |