aid

Wednesday, 22 April 2015

create common and dynamic helpers in MVC

There is way to create common and dynamic helpers in MVC
nnow you create a funcvtion in your helper like this :-

function notification()
{

 $CI =& get_instance();
 $CI->load->model('notification_model');
 $data['all']= $CI->notification_model->view_notification();
 $data['notifications']= $CI->notification_model->get_total_notification();
 return $data;

}
and load that function where you want to access. You can direct access in you view without loading from a controller.

<?php $a=notification(); echo $a['notifications'] ?>
here you will get an array you need to brake it multiple parts and now access it...

No comments:

Post a Comment