Php Zend_导航,用于在布局中显示不同的菜单
正在尝试在ZF上打印大约3个菜单。现在我连一个都拿不出来。不太清楚发生了什么,为什么手册上没有提到如何让它工作 这就是我的布局。phtml:Php Zend_导航,用于在布局中显示不同的菜单,php,model-view-controller,zend-framework,zend-navigation,Php,Model View Controller,Zend Framework,Zend Navigation,正在尝试在ZF上打印大约3个菜单。现在我连一个都拿不出来。不太清楚发生了什么,为什么手册上没有提到如何让它工作 这就是我的布局。phtml: <body> <?php echo $this->layout()->nav; ?> <?php echo $this->layout()->content; ?> </body> 只有内容显示。。。希望能够有不同的菜单类型,如。。。显示(topMenu),显示(lo
<body>
<?php echo $this->layout()->nav; ?>
<?php echo $this->layout()->content; ?>
</body>
只有内容显示。。。希望能够有不同的菜单类型,如。。。显示(topMenu),显示(loggedinSideMenu)之类的东西
有什么想法吗?谢谢这里的几件事 首先,要显示导航,请使用适当的帮助器。在布局文件中
<?php echo $this->navigation()->menu()
->renderMenu($zendNavigationContainer) ?>
然后,在您的布局中
<!-- top menu -->
<?php echo $this->navigation()->menu()
->renderMenu($this->layout()->topMenu) ?>
<!-- side menu -->
<?php echo $this->navigation()->menu()
->renderMenu($this->layout()->loggedInSideMenu) ?>
<?php echo $this->navigation()->menu()
->renderMenu($zendNavigationContainer) ?>
protected function _initNavigation()
{
// get config and create containers as before
// bootstrap layout resource and retrieve it
$this->bootstrap('layout');
$layout = $this->getResource('layout');
// add containers as layout properties
$layout->topMenu = $topMenuContainer;
$layout->loggedInSideMenu = $sideMenuContainer;
}
<!-- top menu -->
<?php echo $this->navigation()->menu()
->renderMenu($this->layout()->topMenu) ?>
<!-- side menu -->
<?php echo $this->navigation()->menu()
->renderMenu($this->layout()->loggedInSideMenu) ?>