Switching contents language in CodeIgniter |
[eluser]Блум[/eluser]
I found a different and IMHO a very easy and harmless way to have a language segment in your URL (http://yoursite.com/en/news/54) without changing the config options. The good thing is that you do not have to have Code: $config['uri_protocol'] = "ORIG_PATH_INFO"; Code: $config['enable_query_strings'] = TRUE; All you have to do is: 1. .htacces Code: RewriteEngine on 2. In index.php (in the root of your project) define a constant from the language query in the URL before CI spread it away. Code: <?php So now you can use the current LANG constant everywhere in your project, and URI Class is working the same: On url: http://yoursite.com/bg/news/42 Code: echo 'Lang:'.LANG."; "; |
Messages In This Thread |
Switching contents language in CodeIgniter - by El Forum - 04-07-2008, 03:25 AM
Switching contents language in CodeIgniter - by El Forum - 04-07-2008, 03:39 AM
Switching contents language in CodeIgniter - by El Forum - 04-07-2008, 05:33 AM
Switching contents language in CodeIgniter - by El Forum - 04-07-2008, 05:41 AM
Switching contents language in CodeIgniter - by El Forum - 04-07-2008, 06:04 AM
Switching contents language in CodeIgniter - by El Forum - 04-08-2008, 07:57 PM
Switching contents language in CodeIgniter - by El Forum - 04-09-2008, 07:07 AM
Switching contents language in CodeIgniter - by El Forum - 04-13-2008, 05:18 AM
Switching contents language in CodeIgniter - by El Forum - 04-13-2008, 06:18 AM
Switching contents language in CodeIgniter - by El Forum - 04-13-2008, 07:21 AM
Switching contents language in CodeIgniter - by El Forum - 06-19-2008, 05:56 PM
|