Croogo : Different layout for different Locate -
how set different layout different locate "translate plugin"
ex:
- with link:
[http://example.com/eng]
should render default.ctp english - and link:
[http://example.com/ja]
should render default.ctp japanese
one way can reading $this->request->params['locale']
variable, available in controller/appcontroller.php file, , change layout according it. this:
class appcontroller extends croogoappcontroller { public function beforerender() { // code... // first, checks if locale parameter not empty if(!empty($this->request->params['locale'])) // then, sets layout each case. // in example, user eng , ja switch($this->request->params['locale']) { case 'eng': $this->layout = 'croogo.eng'; break; case 'esp': $this->layout = 'croogo.ja'; break; } // if empty, loads default locale layout else $this->layout = 'croogo.default'; } // rest of appcontroller code... }
note used croogo prefix layout files. did because wanted layout files loaded within croogo folder. in installation, located in path vendor/croogo/croogo/croogo/view/layouts.
hope helps!
Comments
Post a Comment