zf1:尝试添加导航菜单

时间:2013-01-16 19:40:20

标签: php zend-framework

我正在关注此视频tutorial以添加导航菜单。

所以我刚刚在我的Bootstrap.php添加了它在视频开头(_initNavigation())所说的功能,所以现在就是这样:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

    protected function _initRequest()
    {
        require_once 'Zend/Loader.php';
        Zend_Loader::loadClass('Zend_Translate');
        $translate = new Zend_Translate('array', APPLICATION_PATH . '/languages', null, array('scan' => Zend_Translate::LOCALE_FILENAME));

        $translate->setLocale('en');
        Zend_Registry::set('Zend_Translate', $translate);
    }

    protected function _initNavigation()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();
        $config = new Zend_Config_Xml('/home/tirengarfio/workspace/contractlink/contractlink/wwwAPP/configs/navigation.xml', 'nav');

        $navigation = new Zend_Navigation($config);
        $view->navigation($navigation);
    }
}

但在那之后我收到了这个错误:

  

致命错误:未捕获的异常'Zend_Loader_PluginLoader_Exception'   消息'按名称插入'语言'in   /home/tirengarfio/workspace/contractlink/contractlink/library/Zend/Controller/Plugin/Broker.php   在336行

该错误与我创建的帮助程序有关,但在initNavigation()文件中添加Bootstrap.php函数之前我没有收到该错误。所以我认为错误可能是因为新错误功能..任何帮助?

1 个答案:

答案 0 :(得分:0)

它可以删除这一行:

require_once 'Zend/Loader.php';