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

[eluser]Bhushan[/eluser]
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();
#2

[eluser]umefarooq[/eluser]
can you tell me the helper file name your helper file name should be helpername_helper.php and then call it form controller
Code:
$this->load->helper('helpername');
#3

[eluser]Bhushan[/eluser]
helper file is 'MY_array_helper.php' and function name is getdata().
#4

[eluser]pistolPete[/eluser]
Did you save your helper extension in application/helpers/?
How do you load the helper?
#5

[eluser]aidehua[/eluser]
Try loading the helper like this:

Code:
$this->load->helper('array');

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.
#6

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

Helpers aren't class members. Use:

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




Theme © iAndrew 2016 - Forum software by © MyBB