-- eventhough <[EMAIL PROTECTED]> wrote
(on Thursday, 20 November 2008, 02:00 AM -0800):
> If I add an action to the action stack, how do I grab the output from the
> action?
> 
> Where does the output get stored?

By default, it is appended to the response body. However, in the given
action, you can specify a specific response segment to render to; if you
do this, in your layout, you can fetch it by that segment name.

For example, you could have the following in your action:

    $this->_helper->viewRenderer->setResponseSegment('foo');

which tells the ViewRenderer to render to the "foo" response segment.

Then in your layout view script, pull it as follows:

    $this->layout()->foo;

You can also pull it directly from the response object at any time:

    $response->getBody('foo');


> Christian Münch wrote:
> > 
> > 
> >> Hello,
> >>
> >> Is it possible to run an action within an action?
> >>
> >> Let's say I have two controllers each with one action (foo and bar).
> >>
> >> If the user is at controller1/foo and I would like to run controller2/boo
> >> from within foo, how would I do that?
> >>
> >> Do I need to create my own request object and push a new action to the
> >> action stack?
> >>
> >> Thanks!
> >>   
> > 
> > Yes,
> > 
> > you can use the Action Helper "ActionStack". You can find it in the
> > manual.
> > http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.actionstack
> > 
> > Another option is to forward to another action with the _forward()
> > method of the controller action.
> > 
> > 
> > Christian
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-run-an-action-internally-tp20595526p20598067.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to