帮助根据自己的文件结构设置 Zend 导航
我对 ZF 还很陌生,我必须遵循公司文件结构并在其上设置 Zend Navigation。
我有一个这样的包含脚本:
<?php
//test1.php
$config = new Zend_Config_Xml( $_SERVER{'DOCUMENT_ROOT'}.$sitePath.'lib/navigation.xml', 'nav');
$container = new Zend_Navigation($config);
$view = new Zend_View();
$view->navigation($container);
$view->addScriptPath($_SERVER{'DOCUMENT_ROOT'}.$sitePath);
echo $view->render('test1.php');
?>
<!--And in my View Script:-->
<html>
<head>
</head>
<body>
<div id="menu">
<?php echo $this->navigation()->menu(); ?>
</div>
<div id="breadcrumbs">
You are in: <?php echo $this->navigation()->breadcrumbs()->setLinkLast(false)->setMinDepth(0)->render(); ?>
</div>
<div id="content">
Content of your page here.
</div>
</body>
但是我有这个错误:
Fatal error: Call to a member function getParams() on a non-object in C:\Zend\ZendServer\share\ZendFramework\1.10\library\Zend\Navigation\Page\Mvc.php on line 133
谁能指出我哪里出错了?很多示例都使用 bootstrap 和 MVC,但在我的项目中,我必须坚持使用旧的文件结构(非 MVC),而我现在正在挣扎。
我正在研究这些示例:
http://framework.zend.com/manual /en/zend.navigation.containers.html
I am quite new to ZF, and I have got to follow a company file structure and set up Zend Navigation upon it.
I have got a included script like this:
<?php
//test1.php
$config = new Zend_Config_Xml( $_SERVER{'DOCUMENT_ROOT'}.$sitePath.'lib/navigation.xml', 'nav');
$container = new Zend_Navigation($config);
$view = new Zend_View();
$view->navigation($container);
$view->addScriptPath($_SERVER{'DOCUMENT_ROOT'}.$sitePath);
echo $view->render('test1.php');
?>
<!--And in my View Script:-->
<html>
<head>
</head>
<body>
<div id="menu">
<?php echo $this->navigation()->menu(); ?>
</div>
<div id="breadcrumbs">
You are in: <?php echo $this->navigation()->breadcrumbs()->setLinkLast(false)->setMinDepth(0)->render(); ?>
</div>
<div id="content">
Content of your page here.
</div>
</body>
However I have this error:
Fatal error: Call to a member function getParams() on a non-object in C:\Zend\ZendServer\share\ZendFramework\1.10\library\Zend\Navigation\Page\Mvc.php on line 133
Could anyone point me out where I go wrong? A lot of samples are using bootstrap and MVC but in my project I have to stick with the old file structure (Non-MVC), and I am struggling now.
I am studying these examples:
http://framework.zend.com/manual/en/zend.navigation.containers.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论