Welcome Guest, Not a member yet? Register   Sign In
Calling a function from inside a view
#10

[eluser]ojcarga[/eluser]
When you go to: www.yoursite.com/controller_name/method_name

You are executing a file named controller_name.php that has a method named method_name, right?

So in that file (controller_name.php), in the constructor (for example) you are going to load the helper file something like this
Code:
$this->load->helper('name');

Once the file (helper) has been loaded, you are going to be able to use any function in it...

Lets say I have a helper controlAccess_helper.php in /helpers/
I just load it this way in the constructor of my controller
Code:
$this->load->helper('controlAccess');

and then in the view or in the controller too, I can call the function
Code:
validateAccess();

Code:
function validateAccess(){
        $CI =& get_instance();
        $CI->load->model('/super/super_model');  
        
        ..........................        
    }


Here is the best place you can go for a better understanding:
http://ellislab.com/codeigniter/user-gui...lpers.html



Messages In This Thread
Calling a function from inside a view - by El Forum - 04-27-2012, 02:18 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 03:42 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 03:51 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 04:15 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 04:31 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 05:12 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 06:26 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 07:08 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 07:20 AM
Calling a function from inside a view - by El Forum - 04-27-2012, 03:18 PM
Calling a function from inside a view - by El Forum - 04-30-2012, 02:24 AM
Calling a function from inside a view - by El Forum - 05-02-2012, 12:44 AM
Calling a function from inside a view - by El Forum - 05-07-2012, 01:48 PM
Calling a function from inside a view - by El Forum - 05-08-2012, 01:45 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 03:53 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 06:53 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 07:41 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 08:03 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 08:45 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 08:54 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 09:11 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 09:14 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 09:22 AM
Calling a function from inside a view - by El Forum - 05-08-2012, 03:43 PM
Calling a function from inside a view - by El Forum - 05-09-2012, 12:52 AM
Calling a function from inside a view - by El Forum - 05-09-2012, 07:55 AM
Calling a function from inside a view - by El Forum - 05-09-2012, 09:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB