I have the same variables on different controllers that are sent to my view like this:
Controller A
$data['priv_information'] = $this->m_user_group->get_priv_information();
$data['priv_customer'] = $this->m_user_group->get_priv_customer();
$data['priv_new_model'] = $this->m_user_group->get_priv_new_model();
$data['priv_price'] = $this->m_user_group->get_priv_price();
$data['priv_masspro'] = $this->m_user_group->get_priv_masspro();
$data['priv_product'] = $this->m_user_group->get_priv_product();
$data['priv_calendar'] = $this->m_user_group->get_priv_calendar();
$data['priv_maintenance'] = $this->m_user_group->get_priv_maintenance();
$this->load->view($this->template, $data);
Controller B
$data['priv_information'] = $this->m_user_group->get_priv_information();
$data['priv_customer'] = $this->m_user_group->get_priv_customer();
$data['priv_new_model'] = $this->m_user_group->get_priv_new_model();
$data['priv_price'] = $this->m_user_group->get_priv_price();
$data['priv_masspro'] = $this->m_user_group->get_priv_masspro();
$data['priv_product'] = $this->m_user_group->get_priv_product();
$data['priv_calendar'] = $this->m_user_group->get_priv_calendar();
$data['priv_maintenance'] = $this->m_user_group->get_priv_maintenance();
$this->load->view($this->template, $data);
Doing it this way, I always have to copy and paste the same code to other controllers. I have no problem doing this. However, my big problem is when I need to modify one variable. I have to re-copy - and paste the same code in others controller multiple times. How do I solve this problem to minimize repetition?.
thanks in advance :)