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:


From hardcode.nl


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s