3

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 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
Charles
  • 50,943
  • 13
  • 104
  • 142
Developer
  • 25,073
  • 20
  • 81
  • 128

3 Answers3

3

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"
Developer
  • 25,073
  • 20
  • 81
  • 128
1
resources.view.helperPath.SiteLib_View_Helper_ = APPLICATION_PATH "/../library/SiteLib/View/Helper/"
Xerkus
  • 2,695
  • 1
  • 19
  • 32
  • it is not working i am geting the same error Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'CssHelper' – Developer Mar 01 '11 at 15:57
  • check if your helper file have UTF8 encoding with byte order mark(BOM) I has spent 2 days once to figure it out. Though more likely this isn't the case. – Xerkus Mar 01 '11 at 16:04
  • All I got in my helper file is this class Zend_View_Helper_CssHelper extends Zend_View_Helper_Abstract { function cssHelper() { } } – Developer Mar 01 '11 at 16:10
  • 1
    Ouch. Zend_View_Helper_CssHelper should be SiteLib_View_Helper_CssHelper – Xerkus Mar 01 '11 at 16:10
  • Yes I know. but still it is not working. Now it is not working for bootstrap as well. before when i place Zend it was working using $view->addHelperPath(APPLICATION_PATH.'/../library/SiteLib/View/Helper/'); in my boot strap file. but after changeing "Zend" to "SiteLib", it is not working in both application.ini and boostrap. it is really making me crazy. – Developer Mar 01 '11 at 16:16
  • One more this. I am using modular structure. Does it make any difference for this. – Developer Mar 01 '11 at 16:18
  • `$view->addHelperPath(APPLICATION_PATH.'/../library/SiteLib/View/Helper/', 'SiteLib_View_Helper_');` In your exception message SiteLib_View_Helper_ prefix is not registered. Do you have `new View()` somewhere in your bootstrap? – Xerkus Mar 01 '11 at 16:45
1

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/"
Vika
  • 3,275
  • 18
  • 16