Make a base controller class that extends Zend_Controller_Action which has
your aforementioned code in preDispatch. Have all your controllers extend
this controller, and if they need their own preDispatch code make sure to
call parent::preDispatch(). 

class Your_App_Controller_Action extends Zend_Controller_Action
{

    public function preDispatch()
    {
        //your code
    }

}

class PostController extends Your_App_Controller_Action
{
    //no new preDispatch logic, no need to call preDispatch, happens
automatically
}

class UserController extends Your_App_Controller_Action
{
    //new preDispatch logic, override but call parent::preDispatch()
    public function preDispatch()
    {
        parent::preDispatch();
        //other code
    }

}
-- 
View this message in context: 
http://n4.nabble.com/Same-predispatch-in-every-controller-Where-s-a-better-place-to-put-it-tp1288632p1288818.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to