I am using $data in all my views $this->load->view(\'my_view\', $data);
I have also autoload a Controller following this guide Exten
1: Create MY_Controller
in application/libraries
with following:
class MY_Controller extends Controller { var $data; //constructor function }
2: Replace Controller
to MY_Controller
in all your controller files and load views with $this->data
class Contact extends Controller { //to.. } class Contact extends MY_Controller { $this->load->view('contact_view', $this->data); }
this way you can perform default functions that are applicable for whole site in MY_Controller
like loading settings.