How to load helper from model in CodeIgniter? How to load helper from model in CodeIgniter? codeigniter codeigniter

How to load helper from model in CodeIgniter?


GSto answered $this->load->helper('helpername') but if you are in a model's method, $this simply refers to that model's (class) instance and not to CI global. That won't work!

Instead you need to load the CI global and then load the helper:

// PHP 4// $ci =& get_instance();// PHP 5    $ci = get_instance();$ci->load->helper('text');


You are not need to load helper in a model.Just load helper in a controller and use function in a model as well as we normally use helper function in a controller


$this->load->helper('helpername')