Moo*_*oon 17 zend-framework zend-layout
我想让Zend_Layout包含header.phtml和footer.phtml与[layouy name] .phtml.
我怎么做?我试图在Zend_Layout,Zend_Layout_Controller_Plugin_Layout中读取代码.我还是弄不清楚..
Cor*_*lou 23
您可以在layout.phtml文件中包含页眉和页脚文件.这是一个例子:
<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>
Run Code Online (Sandbox Code Playgroud)
cballou的答案可能就是你想要的,但我想我会把它放在那里以获得好的评价.如果您想在站点的不同部分呈现单独的页眉和页脚视图脚本,可以在每个控制器中执行此操作,如下所示:
Zend_Loader::loadClass('Zend_View');
$header = new Zend_View();
//Set header variables here
$this->view->header = $header->render('header.phtml');
Run Code Online (Sandbox Code Playgroud)
然后使用$ this-> header从布局中拉出渲染的标题.与页脚一样.
| 归档时间: |
|
| 查看次数: |
17003 次 |
| 最近记录: |