I would like to let Zend_Layout include header.phtml and footer.phtml with [layouy name].phtml.
How do I do that? I tried to read codes in Zend_Layout, Zend_Layout_Controller_Plugin_Layout. I still can't figure out it..
I would like to let Zend_Layout include header.phtml and footer.phtml with [layouy name].phtml.
How do I do that? I tried to read codes in Zend_Layout, Zend_Layout_Controller_Plugin_Layout. I still can't figure out it..
You could include your header and footer files from within your layout.phtml file. Here's an example:
cballou's answer is likely what you want, but I thought I'd throw this in there for good measure. If you'd like to render separate header and footer view scripts in different parts of your site, you can do it from within each controller like so:
Then use $this->header to pull the rendered header from within your layout. Likewise with the footer.
I realize this question posed is 4 yrs old but for those who happen upon this and don't realize there's a better way to do this with the latest ZF2, here's the 'better way' - Zend Framework 2 - How to include partial from library
Just another way:
This will go in the controller:
This will go in the view:
Even if we do not use the controller (but only in the view) we can use: