Zend certified PHP/Magento developer

CodeIgniter: Calling routes[‘default_controller’] variable manually

This is a question for codeigniter users (i guess)

I have this in my routes.php config file:

$route['default_controller'] = "news"; 

There are 2 occurrences in my website (not made by me initially) which load/redirect to “news”.

Since the default_controller route defines which page is loaded by default, I thought that it would be dumb to create a second config option to state the same thing aka config['default_page'] = "news" or smthing like that.

So I thought I could call the routes variable like this in the core class extension of “Controller.php”:

$this->standardModule = CI::$APP->router->routes['default_controller']; 

But I’m wondering if it’s bad practice or not, notably for performance.

submitted by /u/Bidibodida
[link] [comments]