Instead of calling same data inside each functions in controllers i want to load that data globally by calling once. i did
MY_Controller.php
<?php
class MY_Controller extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper(array('form', 'url','file'));
$this->load->model('common/common_model');
$data['header_menus'] = $this->common_model->categoryMenus();
}
}
This file is inside core folder and in controller folder there is a controller and i did
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends MY_Controller {
while loading function inside home controller how do i load $data['header_menus'] in views do i need to do saomething with that variable in function again?