本文介绍了如何在Zend Framework中将页眉和页脚包含在布局中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让Zend_Layout包含带有[layouy名称] .phtml的header.phtml和footer.phtml.
I would like to let Zend_Layout include header.phtml and footer.phtml with [layouy name].phtml.
我该怎么做?我试图读取Zend_Layout,Zend_Layout_Controller_Plugin_Layout中的代码.我仍然不知道..
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..
推荐答案
您可以在layout.phtml文件中包含页眉和页脚文件.这是一个示例:
You could include your header and footer files from within your layout.phtml file. Here's an example:
<div id="header"><?= $this->render('layouts/header.phtml') ?></div>
<div id="nav"><?= $this->render('layouts/nav.phtml') ?></div>
<div id="content"><?= $this->layout()->content ?></div>
<div id="footer"><?= $this->render('layouts/footer.phtml') ?></div>
这篇关于如何在Zend Framework中将页眉和页脚包含在布局中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!