Welcome Guest, Not a member yet? Register   Sign In
Which route should I take?
#4

[eluser]simshaun[/eluser]
$route['default_controller'] is a global config key that CodeIgniter uses.
You don't have to actually add it.. it's already there.

Let us say $route['default_controller'] = 'homepage';

When someone navigates to http://yourdomain.tld/admin/,
(This may not be exact, but will give you the idea)

1. CodeIgniter looks for an admin controller in controllers/ but finds none.
2. CodeIgniter looks for an admin directory in controllers/, finds one!
3. No controller specified after /admin/ in the URL, so CI looks for $route['default_controller'] in controllers/admin/ directory.
4. controllers/admin/homepage.php is found. Controller exists so run it.

If in your system directory, controllers/admin/homepage.php didn't exist... I believe CI returns a 404.


Messages In This Thread
Which route should I take? - by El Forum - 01-05-2009, 04:04 PM
Which route should I take? - by El Forum - 01-05-2009, 04:36 PM
Which route should I take? - by El Forum - 01-05-2009, 05:49 PM
Which route should I take? - by El Forum - 01-05-2009, 05:54 PM
Which route should I take? - by El Forum - 01-05-2009, 06:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB