Hello all,
I need a multi language site with cakephp. Ok, this topic is discuss
commonly. But I need a friendly-url solution, something's like:
http://mywebsite.com/lang/controller/view
This is my solution:
file /app/webroot/index.php:
[code]
require CORE_PATH . 'cake' . DS . 'bootstrap.php';
// some code to parse extract language from $url
// in case $url = "/en/products/view/1"
// -->
// $lang = "en"
// $url1 = "/products/view/1";
$Dispatcher = new Dispatcher();
$Dispatcher->dispatch($url1);
// end of /app/webroot/index.php
[/code]
file /app/app_controller.php
[code]
function beforeFilter() {
global $lang;
$this->lang = $lang;
}
function beforeRender() {
$this->set('lang', $this->lang);
}
[/code]
It works correctly on ver 1.1.xxx, but I think it's not a standard
way. There is a comment in /app/webroot/index.php. So my solution may
down with a newer version.
[code]
///////////////////////////////
//DO NOT EDIT BELOW THIS LINE//
///////////////////////////////
[/code]
Anyone has a more standard solution?
Thanks,
Jacob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---