According to Rob Allen’s tutorial : to use a layout into my zend application I should put:
$response = $this->getResponse();
$response->insert('header', $this->view->render('header.phtml'));
$response->insert('sidebar', $this->view->render('sidebar.phtml'));
$response->insert('footer', $this->view->render('footer.phtml'));
into the init() function of the IndexController, to generate the header,footer and the sidebar for every action.
I would like to use the same layout for all my views, should I put this portion of code into all the controllers??? (I’m using ZF 1.11)
thanks.
You can initialize a zend layout by doing the following in your bootstrap:
and you can also specify where your keeping your layouts
Once that’s in place it will be much more efficient than rendering the same view in all your controllers.