Welcome Guest, Not a member yet? Register   Sign In
Want Help

Hi all,

i m new to codeigniter.i have created function in helper and want to access it from controller but it shows 'Call to undefined method'
how can i do this?

helper file is stored in application/helper.
i have loaded helper file using $this->load->helper('MY_array_helper');
then i used function as $data['result']=$this->getdata();

can you tell me the helper file name your helper file name should be helpername_helper.php and then call it form controller

helper file is 'MY_array_helper.php' and function name is getdata().

Did you save your helper extension in application/helpers/?
How do you load the helper?

Try loading the helper like this:


Helper file names end in "_helper.php", but to load them in a CI controller, you don't use the "_helper.php" part of the file name.

Quote:then i used function as $data[‘result’]=$this->getdata();

Helpers aren't class members. Use:

$data['result'] = getdata();

Theme © iAndrew 2016 - Forum software by © MyBB