Jake
Jake

Reputation: 26107

Set a View variable in PostDispatch method of the Controller

How can I assign a view variable during the postDispatch method of the controller in Zend Framework?

Upvotes: 0

Views: 139

Answers (1)

Mircea Soaica
Mircea Soaica

Reputation: 2817

class Your_Class extends Zend_Controller_Plugin_Abstract
{
    public function postDispatch(Zend_Controller_Request_Abstract $request)
    {
        $layout = Zend_Layout::getMvcInstance();

        $view = $layout->getView();

        $view->variable = 'some value';
    }
}

Upvotes: 1

Related Questions