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{ $this->_helper->viewRenderer->setResponseSegment('menu'); /* other code */ }
Then in layout.phtml access it like so:
<H1>Menu</H1> <?= $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:
Do you really want to see the menu standalone; hmm