How to add/register helpers with Zend Framework
        Posted  
        
            by manyxcxi
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by manyxcxi
        
        
        
        Published on 2010-05-15T19:03:33Z
        Indexed on 
            2010/05/17
            5:50 UTC
        
        
        Read the original article
        Hit count: 327
        
I'm just starting out with Zend Framework and am having issues using Zend_Controller_Action_HelperBroker::addPath() to add helpers. I'm not sure if my classes are named incorrectly, I'm giving it the wrong prefix, or what I'm doing wrong so I will post the code and file structure and get out of the way.
In Bootstrap.php public function __construct($application)
{
    ...
    // This works with a manual include_once('../application/plugins/helpers/Csrf.php');
    //Zend_Controller_Action_HelperBroker::addHelper(new Application_Controller_Action_Helper_Csrf());
    // This isn't picking up my helper class automagically
    Zend_Controller_Action_HelperBroker::addPath('../application/plugins/helpers','Application_Controller_Action_Helper');
   ...
}
In application/plugins/helpers/Csrf.php
class Application_Controller_Action_Helper_Csrf extends Zend_Controller_Action_Helper_Abstract
{
   ...
}
My directory tree:
/
application/
   ...
   plugins/
      helpers/
         Csrf.php
      CsrfProtect.php
...
        © Stack Overflow or respective owner