Welcome Guest, Not a member yet? Register   Sign In
Controller Start up Sequence
#1

[eluser]macleodjb[/eluser]
Hi guys,

This is going to be a lame question to you pros out there but for me i still struggle with classes.

My question is when a controller is started up, or just entered into the url, how does it inherit all the start up variables that are defined via the main index.php and main controller codeigniter.php file.

For instance this is the standard welcome controller.

Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('welcome_message');
    }
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

If i were to enter into my url http://www.mysite.com/welcome.php and go directly to this controller, where does this controller gather all the predefined variables such as BASEPATH, APPPATH.

i'm not used to working with classes so my mind is looking for an include file with the function defining BASEPATH.

I guess i need to know what is logically happening when you go directly to this controller. I understand that i have a class which contains two functions but i dont see anything executing the functions.

Thanks in advance.
#2

[eluser]danmontgomery[/eluser]
You never go directly to the controller, you always go to index.php, where codeigniter handles all of the routing.

http://ellislab.com/codeigniter/user-gui...pflow.html
#3

[eluser]macleodjb[/eluser]
Thank you for that. Cleared that up




Theme © iAndrew 2016 - Forum software by © MyBB