【发布时间】:2010-10-15 16:41:55
【问题描述】:
我遇到了一个问题,当在 Zend_Config_Xml 的实例上调用 Zend_Navigation 时会引发异常。
这是失败的方法(Bootstrap.php):
protected function _initNavigation() {
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$config = new Zend_Config_Xml( APPLICATION_PATH . '/configs/navigation.xml' );
$navigation = new Zend_Navigation( $config ); // exception is thrown here
$view->navigation( $navigation );
}
正在解析的 XML 文件完全是示例 37.11 @http://framework.zend.com/manual/en/zend.navigation.containers.html 的副本
抛出的错误:
- 致命错误:在 /usr/share/php/Zend/Navigation/Page.php:223 中未捕获异常“Zend_Navigation_Exception”,并带有消息“无效参数:无法确定要实例化的类”:223 堆栈跟踪:#0 /usr/share /php/Zend/Navigation/Container.php(117): Zend_Navigation_Page::factory(Array) #1 /usr/share/php/Zend/Navigation/Container.php(164): Zend_Navigation_Container->addPage(Array) #2 /usr/share/php/Zend/Navigation.php(46): Zend_Navigation_Container->addPages(Object(Zend_Config_Xml)) #3 /www/padilla/application/Bootstrap.php(50): Zend_Navigation->__construct(Object(Zend_Config_Xml) )) #4 /usr/share/php/Zend/Application/Bootstrap/BootstrapAbstract.php(662): Bootstrap->_initNavigation() #5 /usr/share/php/Zend/Application/Bootstrap/BootstrapAbstract.php(615 ): Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('navigation') #6 /usr/share/php/Zend/Application/Bootstrap/BootstrapAbstract.php(579): Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #7 /usr/share/php /Zend/Application.php(347): Zend_Application_B 在 /usr/share/php/Zend/Navigation/Page.php 的第 223 行
也许我遗漏了什么,或者需要更改/自定义 xml 结构?
【问题讨论】:
-
你能粘贴你的navigation.xml吗?
标签: zend-framework zend-navigation