How to call codeigniter functions in helper?

Go To StackoverFlow.com

0

I want to know how to call codeigniter functions in a helper is it possible?

Thank You

2012-04-05 00:19
by danny
http://codeigniter.com/userguide/general/creatinglibraries.html Read the part about get_instance. I'd make an answer, but I'm too tired - Rocket Hazmat 2012-04-05 00:21
Unfortunately, this is far too vague for the Stack Overflow format. You'll need to supply some code you've tried that didn't work or do a bit of research on your own and come back with a specific problem - rdlowrey 2012-04-05 00:21
I am asking about helper not about libraries - danny 2012-04-05 00:28
@rdlowrey I am asking how to use codeignter functions etc $this->input->post() in helper functions? In Libraries we can use through get_instance - danny 2012-04-05 00:50
@danny: You do the same thing for helpers. Get the CodeIgniter super object (via get_intance) and you're good to go - Colin Brock 2012-04-05 03:39


2

Per the comments above, you would do the same thing with helpers as you would with libraries. That is, get the CodeIgniter super object via get_instance:

function some_helper_function(){

    $CI =& get_instance();
    // Now you can access whatever CodeIgniter resource via $CI

}
2012-04-05 03:43
by Colin Brock
Ads