The best pactice is to define a base controller and allow other controllers to extend it, instead of directly calling a methodZend_Controller_Action
class ApplicationController extends Zend_Controller_Action {
public function preDispatch() {
$this->view->success = $this->success;
$this->view->warning = $this->warning;
$this->view->error = $this->error;
}
}
Your other regular controllers will be like
class IndexController extends ApplicationController {
}
(, ) views/layout, In ApplicationController.php .