Best way to include page header/footer in zend framework using MVC
What is the best way to include a page header and footer within zf whilst using MVC?
At the moment I have this in my bootstrap:
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{
static public function displayHeader(){
return 'pageheader';
}
}
and then within a controller I can do something like:
$this->view->header = Bootstrap::displayHeader();
Is there a better way to do this? Could I perhaps combine it with render() and use the displayHeader to generate all the required variables then use render() to load the header.phtml file?
Any insi开发者_如何学JAVAght would be great!
You put that into your layout.phtml
<body>
<?php echo $this->render('header.phtml') ?>
<div id="nav"><?php echo $this->placeholder('nav') ?></div>
<div id="content"><?php echo $this->layout()->content ?></div>
<?php echo $this->render('footer.phtml') ?>
</body>
精彩评论