Usually, if you used the CLI to create a zend project, it will already be able to accomplish what you request. If you run the scripts /view/errors/error.phtml, it will be a phtml file that you can use to create the view you want to use.
Although, if you did not use the CLI to create the zend project below, the created ErrorController is used
<?php
class ErrorController extends Nanaly_Controller
{
public function errorAction()
{
$errors = $this->_getParam('error_handler');
switch ($errors->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ROUTE:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
$this->getResponse()->setHttpResponseCode(404);
$this->view->message = 'Page not found';
break;
default:
$this->getResponse()->setHttpResponseCode(500);
$this->view->message = 'Application error';
break;
}
if ($log = $this->getLog()) {
$log->crit($this->view->message, $errors->exception);
}
if ($this->getInvokeArg('displayExceptions') == true) {
$this->view->exception = $errors->exception;
}
$this->view->request = $errors->request;
}
public function getLog()
{
$bootstrap = $this->getInvokeArg('bootstrap');
if (!$bootstrap->hasPluginResource('Log')) {
return false;
}
$log = $bootstrap->getResource('Log');
return $log;
}
}
Note: this controller was generated using Zend Version 1.10.0
and the presentation should be located in the same place as previously indicated.
source
share