Answer the question
In order to leave comments, you need to log in
How to change/add routers in codeigniter using a hook?
There is a question in changing routers from the codeigniter config.
There are some routing rules in config/routes.php, for example:
$route['default_controller'] = 'pages/page';
$route['404_override'] = '';
$route['manager'] = 'manager';
...
$route['(ru|en|fr)/manager'] = 'manager';
...
Answer the question
In order to leave comments, you need to log in
Of course, I don’t know the conditions of the task to the end, but what prevents you from checking for the existence of a certain file directly in routes.php? In the same place, depending on the result of the condition, apply the desired $route[]
Well, for starters, take a look here.
code-igniter.ru/user_guide/general/hooks.html
Then make the following settings for yourself.
$hook['pre_system'] = array(
'class' => 'MyClass',
'function' => 'Myfunction',
'filename' => 'Myclass.php',
'filepath' => 'hooks',
'params' => array()
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question