mam taki problem, chciałem dodać obsługę błędów w mojej aplikacji i nie do końca wiem jak mam to zrobić bo w necie nie specjalnie o tym mowa.
Mam sobie następującą funkcję z ErrorController.
public function errorAction() { $this->view->headLink()->appendStylesheet($this->view->baseUrl('/css/default/default.css')); $this->view->headLink()->appendStylesheet($this->view->baseUrl('/css/default/error.css')); if ($this->_request->isXmlHttpRequest()) $this->_helper->getHelper('layout')->disableLayout(); $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: // 404 error -- controller or action not found $this->disableLayoutHTTP(); $this->getResponse()->setHttpResponseCode(404); $this->renderScript('/error/404.phtml'); break; default: // application error $this->disableLayoutHTTP(); $this->getResponse()->setHttpResponseCode(500); $this->renderScript('/error/500.phtml'); break; } // Log exception, if logger available if ($log = $this->getLog()) { $log->crit($this->view->message, $errors->exception); } // conditionally display exceptions if ($this->getInvokeArg('displayExceptions') == true) { $this->view->exception = $errors->exception; } $this->view->request = $errors->request; }
I co mam teraz zrobić aby dodać np 403 lub 401 ? Bo ogólnie nie wiem nawet jak się za to zabrać, próbowałem na wiele sposobów ale nic mi nie wychodzi. Jak ktoś mia jakiś pomysł to niech pisze. Każda sensowna myśl lepsza niż jej brak.