I am using $data in all my views $this->load->view('my_view', $data);
I have also autoload a Controller following this guide Extending Core Controller
But I want to make $data global because in views there is a sidebar which is constant for whole project and displays info fetched through db in autoloaded controller
Currently I have to manually write $data[‘todo’] for each and fetch info from autoloaded model.
Thank You.
1: Create
MY_Controllerinapplication/librarieswith following:2: Replace
ControllertoMY_Controllerin all your controller files and load views with$this->datathis way you can perform default functions that are applicable for whole site in
MY_Controllerlike loading settings.