Cakephp - how to make error pages have its own layouts?

后端 未结 6 1399
被撕碎了的回忆
被撕碎了的回忆 2021-02-13 16:00

I wanna have a different layout for the page not found 404 page. How can i set a different layout for that page?

6条回答
  •  庸人自扰
    2021-02-13 16:30

    Savant from the IRC helped me out and he suggest in using beforeRender(){} in the app_controller

    // Before Render
    function beforeRender() {
        if($this->name == 'CakeError') {
            //$this->layout = 'error';
        }
    }
    

    CakeError is a catchAll for errors :D

提交回复
热议问题