有一个使用时出现问题
resources.view.helperPath.App_View_Helper = APPLICATION_PATH "/../library/App/views/helpers"
我可以不访问视图h elper在模块中甚至是本地帮助者。(在注册表中找不到名为'LoggedInAs'的插件),但仍在视图模板文件中工作。
我把这个代码“echo Zend_Debug :: dump($ this)”放在布局文件的末尾,并且有一部分输出。
["_prefixToPaths:protected"] => array(3) {
["Zend_View_Helper_"] => array(2) {
[0] => string(17) "Zend/View/Helper/"
[1] => string(16) "./views\helpers/"
}
["ZendX_JQuery_View_Helper_"] => array(1) {
[0] => string(25) "ZendX/JQuery/View/Helper/"
}
["Zend_View_Helper_Navigation_"] => array(1) {
[0] => string(28) "Zend/View/Helper/Navigation/"
}
}
但是在引导文件中使用这些代码时没有问题。
//Initialize and/or retrieve a ViewRenderer object on demand via the helper broker
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->initView();
//add the global helper directory path
$viewRenderer->view->addHelperPath(APPLICATION_PATH.'/../library/App/views/helpers', 'App_View_Helper');
产量为象下面这样:
["_prefixToPaths:protected"] => array(4) {
["Zend_View_Helper_"] => array(3) {
[0] => string(17) "Zend/View/Helper/"
[1] => string(16) "./views\helpers/"
[2] => string(86) "D:/zf/application/modules/default/views\helpers/"
}
["App_View_Helper_"] => array(1) {
[0] => string(85) "D:\zf\application/../library/App/views/helpers/"
}
["ZendX_JQuery_View_Helper_"] => array(1) {
[0] => string(25) "ZendX/JQuery/View/Helper/"
}
["Zend_View_Helper_Navigation_"] => array(1) {
[0] => string(28) "Zend/View/Helper/Navigation/"
}
}
非常感谢您节省了我5小时 – 2014-06-09 12:53:53