2009/3/17 Garrison Locke <[email protected]> > So, I have a Front Controller Plugin that is running post dispatch that > needs to add some debug data to the front of the response body. It only > needs to perform this action if the action was rendered. So in the action > we're setting setNoRender for the action and then in the front controller > plugin, we check the getNoRender() method to see if it's true or false. >
noRender options is there to prevent multiple automatic rendering of actions - if you do a render() in you action method, the automagic in ViewRenderer will not render your 'views/scripts/controller-name/action-name.phtml'. > The problem is that after the action is rendered, setNoRender() is called > in the renderScript method of Zend_Controller_Action_Helper_ViewRenderer to > prevent double rendering. So, getNoRender() will always return true > regardless of whether or not it was set in the action. This is true. > If we use setNeverRender() instead, this all works as expected, but it > seems like a hack to say, "you have to just use setNeverRender because > setNoRender/getNoRender doesn't act as one would expect it to." > Think of it as: if I use NoRender, I'm saying I have already rendered a view and the ViewRenderer has to shut up and doing nothing. If I use NeverRender, no views should be rendered: the one designated from controller/action names and the plugin ones. It is also not reset after the dispatch loop, so if you're pushing other actions (ActionStack to generate a side menu for example) they will also not rendered. I think this is the correct behaviour. -- Giorgio Sironi Piccolo Principe & Ossigeno Scripter http://ossigeno.sourceforge.net
