有一個使用時出現問題
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