• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to retrieve routes['default_controller']

#1
[eluser]stormbytes[/eluser]
I'm trying to grab the default controller via one of my libs. Tried the obvious ($CI->uri->router->routes['default_controller']) with no luck. Anyone got a suggestion?

#2
[eluser]InsiteFX[/eluser]
Code:
$this->CI->config->item('default_controller');

InsiteFX

#3
[eluser]stormbytes[/eluser]
Come on... no way..

Couldn't be that easy.

I'm omitting the $this as I'm accessing $CI through a library. Returns FALSE.

#4
[eluser]wiredesignz[/eluser]
The Router has a $default_controller class variable. Beware that this may become a protected value in the future. It may be more appropriate to extend the CI_Router class and add your own get_default_controller() method.

@InsiteFX, default_controller has never been stored in the CI config items?

#5
[eluser]stormbytes[/eluser]
[quote author="wiredesignz" date="1303025079"]Extend the CI_Router class and add your own get_default_controller() method.[/quote]

Now there's a sound idea! Smile

#6
[eluser]InsiteFX[/eluser]
Quote:@InsiteFX, default_controller has never been stored in the CI config items?

Thanks wiredesignz, I did not know that I thought it was added along with all the other config arrays!

InsiteFX


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.