-- Jijo <[EMAIL PROTECTED]> wrote
(on Tuesday, 07 October 2008, 02:08 AM -0700):
> I am trying to use action hlper in index controller and having some problem
> with it.
> I created action helper in modules/website/action/helpers/Secure.php
>
> class modules_website_action_helpers_Secure extends
> Zend_Controller_Action_Helper
<snip>
> Then i registered it with the helper broker in my bootstrap:
>
>
> Zend_Controller_Action_HelperBroker::addPrefix('modules_website_action_helpers');
>
> and i am calling it in my action in indexcontroller as
> $this->_helper->secure();
>
> But iam getting error
> Fatal error: Uncaught exception 'Zend_Controller_Action_Exception' with
> message 'Action Helper by name Secure not found.' in
The problem has to do with how the class loader constructs the class
name. You should use the addPath() method instead for adding the path to
the helpers, as it allows specifying both the path and the prefix
explicitly, and should help fix the situation:
Zend_Controller_Action_HelperBroker::addPath(
realpath('path/to/application/modules/website/action/helpers'),
'modules_website_action_helpers'
);
of course, substituting the correct path to the directory. BTW, our
recommendation is to put action helpers in the 'controllers/helpers/'
subdirectory of your module.
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/