Page 1 of 1

[ZF] content from _forward in segment defined by caller

Posted: Sun Jul 08, 2007 1:08 pm
by willemj
I use a subclass of Zend_Controller_Response_Http to put the content of named segments into a layout. Inside a controller it's easy (and working) to render a view to a particular segment using:

Code: Select all

$this->render('action', 'segment');
The ouput from 'action' in the current module is placed in segment 'segment'.

But I want to call an action in a different module and have it's output put into a different segment from the current action. According to the documention I should use this:

Code: Select all

// set the segment the view is rendered too
$this->_helper->viewRenderer->setResponseSegment('navigation');
// call action categeryNavigation in controller category in module products
$this->_forward('categoryNavigation', 'category', 'products');
But the content from the categoryNavigation-action is not rendered into 'navigation'.

As far as I understand there is only one view instance so calling setResponseSegment should change the segment and thus put the output of the categoryNavigation action there. But it's not so: is there a new instance when this action is executed? Or is the instance of the view object reset in some way before the new action is executed?