Indeed, the plugin postDispatch() is invoked after the helper postDispatch
(the ViewRenderer is a helper) where the rendering happens. If you need
stuff to happen after the action but before rendering, it must be in a
controller postDispatch or a helper postDispatch with a higher priority than
ViewRenderer. Thankfully, the ViewRenderer has a very low priority so just
add the helper through the HelperBroker and you can be sure it would be
invoked before the ViewRenderer.

Zend_Controller_Action_HelperBroker::addHelper(new My_Helper());

class My_Helper extends Zend_Controller_Action_Helper_Abstract
{
    public function postDispatch()
    { /* pre-render logic here */ }
}

   -- Mon


On Mon, Jun 8, 2009 at 4:42 PM, agatone <zoran.z...@gmail.com> wrote:

>
> I think I got happy  to fast :)
> If i use setRender() in action, postDispatch() of the controller is called
> before the script rendereing - that's ok.
>
> But Controller Plugin's postDispatch is still called after the render ?
> should this be called before the render also?
>
> Thing is that i tried it calling it inside
>
> agatone wrote:
> >
> > Great, it is working.
> >
> > Thank you!
> >
> >
> >
> > Mon Zafra wrote:
> >>
> >> You probably want $this->_helper->viewRenderer->setRender($action), but
> >> only
> >> the one in the postDispatch() will take effect since it is always
> >> executed
> >> after the action.
> >>
> >>    -- Mon
> >>
> >>
> >> On Mon, Jun 8, 2009 at 6:12 AM, agatone <zoran.z...@gmail.com> wrote:
> >>
> >>>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23920339.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to