Is it possible to set different layouts for different errors in cakephp1.3?
this is my AppError class
function _outputMessage($template) {
$this->controller->beforeFilter();
$this->controller->render($template);
$this->controller->afterFilter();
echo $this->controller->output;
}
function error404($params) {
extract($params, EXTR_OVERWRITE);
header("HTTP/1.0 404 Not Found");
$this->error(array('code' => '404',
'name' => 'Not found',
'message' => sprintf("page not found %s", $url, $message),
'base' => $base));
exit();
}
function item404($params) {
extract($params, EXTR_OVERWRITE);
header("HTTP/1.0 404 Not Found");
$this->error(array('code' => '404',
'name' => 'Not found',
'message' => sprintf("Item not found %s", $url, $message),
'base' => $base));
exit();
}
I want to have layout “error” and layout “itemerror”, respectively.
I have tried setting the layout in the functions, but it does not work.
Any help appreciated,
Sure, just change the layout of the controller.
This assumes you continue using the default
_outputMessage()method.