Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

Help me with "MY_Router" Controller

$
0
0
Hello,

I'm creating a translation system "l10n" for my application developed with CodeIgniter.

I need help to create a controller "MY_Router" to accept the language passed by the URL before the DEFAULT CONTROLLER.

Example:
http://www.myapplication.com/en-US/welcome

I made some changes to the file "application/config/routes.php", but I would like to have a controller to handle this new URL.

Follow file content "application/config/routes.php"

PHP Code:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

// Translation Router
$route['^(:any)/(.+)$'] = '$2';
$route['^(:any)$'] = $route['default_controller']; 

I'd like to bounce a controller "MY_Router" that would eliminate the addition of rules in the file "application/config/routes.php".


Example:
PHP Code:
require APPPATH 'third_party/MX/Router.php';

class 
MY_Router extends MX_Router {
 
   
    
//Code Here!
 
   


Thanks to anyone who can help me!

Best regards,
João Antonio Trocades

Viewing all articles
Browse latest Browse all 14114


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>