Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-08 Thread agatone

Sorry, yes you are right. PostDispatch of plugin always occours after the
rendering of the view.
I'll try the solution with adding helper, thank you.
I hoped i can solve it directily in the plugin.

thanks


Mon Zafra wrote:
> 
> That's not true. The plugin postDispatch always occurs after the
> rendering.
> It doesn't matter if you manually render in the controller or let the
> ViewRenderer render. The plugin postDispatch will still be called
> afterward.
> You are also not altering the application flow by changing the action
> script
> in the ViewRenderer. You're simply changing the value of an instance
> member.
> And I believe that's exactly what you want. I'm not sure what led you to
> believe that the flow is altered, but perhaps you could share with us some
> code so we could see what's happening.
> 
>-- Mon
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23929707.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-08 Thread Mon Zafra
That's not true. The plugin postDispatch always occurs after the rendering.
It doesn't matter if you manually render in the controller or let the
ViewRenderer render. The plugin postDispatch will still be called afterward.
You are also not altering the application flow by changing the action script
in the ViewRenderer. You're simply changing the value of an instance member.
And I believe that's exactly what you want. I'm not sure what led you to
believe that the flow is altered, but perhaps you could share with us some
code so we could see what's happening.

   -- Mon


On Mon, Jun 8, 2009 at 6:32 PM, agatone  wrote:

>
> What i mean in all this is :
> If i don't change what script to render and leave it to find script to
> render byitself the flow is that every postDispatch() (controllers and
> plugins) is called before the render of view sscript.
>
> As soon as i try to render myown script postDispatch() is called after
> render of the view.
>
> In all this i am looking something that I can use just to tell what should
> be rendered and not to alter the flow - keep it same as if i wouldnt change
> the view script.
>
> All this solutions adding new stuff on it is way to much work for something
> simple :|
>
>
> Mon Zafra wrote:
> >
> > 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  wrote:
> >
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23921673.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-08 Thread agatone

What i mean in all this is :
If i don't change what script to render and leave it to find script to
render byitself the flow is that every postDispatch() (controllers and
plugins) is called before the render of view sscript.

As soon as i try to render myown script postDispatch() is called after
render of the view.

In all this i am looking something that I can use just to tell what should
be rendered and not to alter the flow - keep it same as if i wouldnt change
the view script.

All this solutions adding new stuff on it is way to much work for something
simple :|


Mon Zafra wrote:
> 
> 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  wrote:
> 
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23921673.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-08 Thread Mon Zafra
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  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  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.
>
>


Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-08 Thread agatone

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  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.



Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-07 Thread agatone

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  wrote:
> 
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23918827.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Controller flow changes when using render() inside controller action

2009-06-07 Thread Mon Zafra
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  wrote:

>
> I have a controller action that picks out what script is going to render.
> So
> I use render('scriptname.phtml') inside my action. There is scenario where
> I
> have to alter some view scripts and i do that inside controller's
> postDispatch() method - since i want it for all actions inside that
> controller. But in combination with the render() inside action,
> postDispatch() gets executed when view already rendered. If i don't use
> render() then postDispatch() is executed before the view rendering.
> My guess is that that is kinda wrong - in a way - since actual rendereing
> should allways be done at the same point of the execution flow in this case
> always after postDispatch() - no matter what.
>
> Is there a way to only set the name of script to be rendered later? If not
> then I guess I'll have to handle that on my own with some property of the
> controller and have some controller plugin with postDispatch() that calls
> render with that value.
>
> ty
> --
> View this message in context:
> http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23915931.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


[fw-general] Controller flow changes when using render() inside controller action

2009-06-07 Thread agatone

I have a controller action that picks out what script is going to render. So
I use render('scriptname.phtml') inside my action. There is scenario where I
have to alter some view scripts and i do that inside controller's
postDispatch() method - since i want it for all actions inside that
controller. But in combination with the render() inside action,
postDispatch() gets executed when view already rendered. If i don't use
render() then postDispatch() is executed before the view rendering. 
My guess is that that is kinda wrong - in a way - since actual rendereing
should allways be done at the same point of the execution flow in this case
always after postDispatch() - no matter what.

Is there a way to only set the name of script to be rendered later? If not
then I guess I'll have to handle that on my own with some property of the
controller and have some controller plugin with postDispatch() that calls
render with that value.

ty
-- 
View this message in context: 
http://www.nabble.com/Controller-flow-changes-when-using-render%28%29-inside-controller-action-tp23915931p23915931.html
Sent from the Zend Framework mailing list archive at Nabble.com.