I have this core controller in my code igniter app and I want to pass a view variable to all my views.
My view is loaded in my normal controllers, so I can't load the view again in my Core controller.
So, how am I gonna do that?
I tried using $data['fromCoreVar']
and I tried $fromCoreVar
. Neither of both does work which is incredibly well understandable. But, I want it to work.
What is the solution?
In your core controller, declare a variable:
protected $data;
Then in your core controller, assign data to the variable like:
$this->data['some_index'] = 'some value';
In your child controller you use $data in the same way:
$this->data['other_index'] = 'other value';
and pass it all to your view:
$this->load->view('my_view', $this->data);