Welcome Guest, Not a member yet? Register   Sign In
How to retrieve the value of 'default_controller' ?
#1

[eluser]stormbytes[/eluser]
I'm wondering if it's possible to retrieve the value for 'default_controller' from Routes?
#2

[eluser]InsiteFX[/eluser]
Code:
$this->router->fetch_class();

InsiteFX
#3

[eluser]stormbytes[/eluser]
Hiya InsiteFX Smile

I don't think that's right... $this->router->fetch_class() returns the 'current' class (and not the default_controller). Now, I don't actually "know" this Smile But after watching the Netbeans debugger cycle through enough times, you start deducing things Smile

Especially when the $var I've assigned that result to changes with each pass!

I do know it's somewhere in the Router class..
#4

[eluser]stormbytes[/eluser]
Oh here's a source:


Quote:fetch_class()
function fetch_class( )
Fetch the current class
Returns string
Access public
Defined in libraries/Router.php, line 321


URL: http://www.tig12.net/downloads/apidocs/codeigniter/libraries/CI_Router.class.html
#5

[eluser]stormbytes[/eluser]
In case someone comes across this post looking for the same...

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'] == '') ?

Taken from: http://ellislab.com/forums/viewthread/159796/




Theme © iAndrew 2016 - Forum software by © MyBB