/**
  * Standard preDispatch() hook
  * 
  * Determines what type of errors are present, sets appropriate http reponse 
  * code, and clears previous body content prior to rendering.
  *
  */
 public function preDispatch()
 {
     parent::preDispatch();
     // set up errors
     $errors = $this->_getParam('error_handler');
     // clear response body and set layout
     $this->getResponse()->clearBody();
     // handle errors from default error handler
     if ($errors) {
         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->getResponse()->setHttpResponseCode(404);
                 $this->_helper->viewRenderer->setRender('error-404');
                 $this->view->headTitle('Page Not Found');
                 $this->view->message = 'Page Not Found';
                 break;
             default:
                 // application error
                 $this->getResponse()->setHttpResponseCode(500);
                 $this->_helper->viewRenderer->setRender('error-500');
                 $this->view->headTitle('Internal Server Error');
                 $this->view->message = 'Internal Server Error';
                 break;
         }
     }
 }
 /**
  * Standard preDispatch() hook
  *
  * Simply changes the layout for displaying subscriptions.
  *
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_helper->layout()->setLayout('subscription');
 }