CodeIgniter Forums
Get and Override Default Controller Programmatically - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Get and Override Default Controller Programmatically (/showthread.php?tid=53619)

Pages: 1 2


Get and Override Default Controller Programmatically - El Forum - 08-01-2012

[eluser]CroNiX[/eluser]
These should work. You have to access the router object, not "routes"...
Code:
print_r($this->router->routes);
or
Code:
global $RTR;
print_r($RTR->routes);

Code:
echo $this->router->routes['default_controller'];



Get and Override Default Controller Programmatically - El Forum - 08-01-2012

[eluser]TWP Marketing[/eluser]
<facepalm> Thanks CroNix, that solves it.


Get and Override Default Controller Programmatically - El Forum - 08-01-2012

[eluser]CroNiX[/eluser]
Sure, although I'm not sure what good it will do. You can only really use it to check something, not set it, since the router has already done the routing before it gets to the controller.