简体   繁体   中英

CakePHP layout not changing

I am working in CakePHP 2.3.0, I developed app using default layout. Now I need to change the layout to design.ctp but the app is rendering default.ctp

    public function myfun() {
      $this -> layout = 'design';

    }

I tried to clear the cache and switched ON the debug mode but the app is still picking the default.ctp

In your controller

class MyTestController extends AppController {
    var $layout = 'default'; 

and in your action try

public function myfun() {
  $this->layout = 'design';
}

Now, your view will use design.ctp, which is stored in views/layouts/.

$this->layout = false; comment above line and it will work fine if you are palcing your lay

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM