Welcome Guest, Not a member yet? Register   Sign In
accessing default_controller
#1

[eluser]iConTM[/eluser]
In my controller class I want to get the default_controller value defined in 'congif/routes.php'

I've tried this but without success:

Code:
$home = $this->config->item('default_controller' , 'route');

tx
#2

[eluser]pickupman[/eluser]
In /system/router.php accesses the $route array via
Code:
// Load the routes.php file.
@include(APPPATH.'config/routes'.EXT);
$this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route;

// Set the default controller so we can display it in the event
// the URI doesn't correlated to a valid controller.
$this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);
#3

[eluser]iConTM[/eluser]
Ah, didn't know a controller has a routes object Confused.

thanks




Theme © iAndrew 2016 - Forum software by © MyBB