Zend Framework - Set response segment in controller actions

The default response segment your controllers action are outputting to is 'content'.

To change/set what response segment is written to inside your controller actions you can use the setResponseSegment method of the viewrenderer helper:

public function menuAction{
	/*  other code  */

Then in layout.phtml access it like so:

<?= $this->layout()->menu ?>
<H1>Main Content</H1>
<?= $this->layout()->content ?>

For some reason I couldn' t find this anywhere in the Zend framework documentation.

I found it here:


thanks a lot :)
In this case '$this->layout()->content' would be left empty?

Do you really want to see the menu standalone; hmm
Content is the default response segment. So any other methods would write to it by default.
rendered @ Mon Mar 31 20:06:26 CEST 2014