zend view helper configure path(works in bootstrap but does not work in application.ini)?
This problem really making me crazy. When I add my view Helper path in bootstrap file.
$view->addHelperPath(APPLICATION_PATH.'/../library/SiteLib/View/Helper/');
It works perfectly alright.
But when I shift this to APPLICATION.INI file (where it should be). It simple don't work
resources.view[] =
resources.view.helperPath.SiteLib_View_Helper_CssHelper = APPLICATION_PATH "/../library/SiteLib/View/Helper/"
I don't know what I am doing wrong. Can anyone help me please.
here is my view helper class
class Zend_View_Helper_CssHelper extends Zend_View_Helper_Abstract
{
function cssHelper() { }
}
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'CssHelper' in /web/zend/zendbase/library/Zend/Loader/PluginLoader.php on line 412
( ! ) Zend_Loader_PluginLoader_Exception: Plugin by name 'CssHelper' was not found in the registr开发者_StackOverflow社区y; used paths: Login_View_Helper_: /web/zend/zendbase/application/modules/login/views/helpers/ ZendX_JQuery_View_Helper_: ZendX/JQuery/View/Helper/ Zend_View_Helper_: Zend/View/Helper/:/web/zend/zendbase/application/../library/SiteLib/View/Helper/:/web/zend/zendbase/application/modules/default/views/helpers/ in /web/zend/zendbase/library/Zend/Loader/PluginLoader.php on line 412
Call Stack
# Time Memory Function Location
1 0.0001 53524 {main}( ) ../index.php:0
2 0.0451 1467432 Zend_Application->run( ) ../index.php:60
3 0.0452 1467432 Zend_Application_Bootstrap_Bootstrap->run( ) ../Application.php:366
4 0.0452 1467432 Zend_Controller_Front->dispatch( ) ../Bo
Finally I figure out the problem myself.
I was overwrite the Zend_View in bootstrap
protected function _initView()
{
$view = new Zend_View($this->getOptions());
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
}
I just shifted the above code in application.ini and remove that function from bootstrap file. and it is working now. :)
resources.view.helperPath.ZendX_JQuery_View_Helper = APPLICATION_PATH "/ZendX/JQuery/View/Helper"
resources.view.helperPath.SiteLib_View_Helper_ = APPLICATION_PATH "/../library/SiteLib/View/Helper/"
You need to specify the prefix, not the actual class name of a single helper:
resources.view[] =
resources.view.helperPath.SiteLib_View_Helper = APPLICATION_PATH "/../library/SiteLib/View/Helper/"
精彩评论