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

Harsha M V picture Harsha M V · Oct 10, 2010 · Viewed 16.8k times · Source

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

Answer

Harsha M V picture Harsha M V · Oct 10, 2010

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