Zend view helper configure path (works in bootstrap but doesn't work in application.ini)?

This problem really makes me go crazy. When I add my helper path to the bootstrap file.

$view->addHelperPath(APPLICATION_PATH.'/../library/SiteLib/View/Helper/');

Everything works perfectly.

But when I transfer this to the APPLICATION.INI file (where it should be). It just doesn't work.

resources.view[] =
resources.view.helperPath.SiteLib_View_Helper_CssHelper = APPLICATION_PATH "/../library/SiteLib/View/Helper/"

I do not know what I am doing wrong. Can anybody help me.

here is my subview 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 registry; 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
+3
source share
3 answers

Finally, I will figure out the problem myself.

I was rewriting 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 moved the above code to application.ini and removed this function from the bootstrap file. and it works now. :)

resources.view.helperPath.ZendX_JQuery_View_Helper = APPLICATION_PATH "/ZendX/JQuery/View/Helper"
+3
source
resources.view.helperPath.SiteLib_View_Helper_ = APPLICATION_PATH "/../library/SiteLib/View/Helper/"
+1
source

You need to specify a prefix, not the actual class name for one helper:

resources.view[] =
resources.view.helperPath.SiteLib_View_Helper = APPLICATION_PATH "/../library/SiteLib/View/Helper/"
+1
source

Source: https://habr.com/ru/post/1795529/


All Articles