How to add/register helpers with Zend Framework
- by manyxcxi
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
...