[cakephp][1.2.x.x]URLで言語を切り替える方法

routes.php
$bits = explode('/', $_GET['url']);
foreach($bits as $strUrl){
    if($strUrl === 'ja' || $strUrl === 'en'){
        Configure::write('Config.language', $strUrl);
	Router::connect("/$strUrl/admin/:controller/:action/*", 
                array(
                    'controller' => ':controller',
                    'prefix' => 'admin',
                    'action' => ':action'
                )
                );
        break;
    }
}

 

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

コメントはまだありません。

コメントする

(必須)

(必須)