-- scabro <[email protected]> wrote
(on Friday, 27 November 2009, 07:32 AM -0800):
> I’m just starting with Zend Framework and find it very frustraiting that all
> sources out there are referring to the previous versions of the framework –
> while I’m using the latest one (recommended) and can’t quite figure out how
> to replace all those configuration differences in the new version.
> The problem I have is the Action Helpers – how can I register them – in
> other words where do I define the path to the action helpers folder.
>
> I’ve seen several options - one with the Bootstrap.php by creating the
> method:
>
> protected function _initActionHelpers() {
> Zend_Controller_Action_HelperBroker::addPath(
> APPLICATION_PATH.”/controllers/helpers”);
> }
>
> This however didn’t solve my problem – I’m still getting error: “Fatal
> error: Class ‘My_Action_Helper_Initializer’ not found in…”.
You need to tell addPath() the class prefix that is used for classes in
that directory as well:
Zend_Controller_Action_HelperBroker::addPath(
APPLICATION_PATH . '/controllers/helpers',
'My_Action_Helper'
);
> Then I’ve also tried to add the path to the application.ini file in the
> following way:
>
> resources.frontcontroller.actionhelperpaths.Helper = APPLICATION_PATH
> “/controllers/helpers”
>
> But this has caused another error.
Again, you need to specify the class prefix used. Assuming the same
class prefix as quoted above, this can be done as follows:
resources.frontcontroller.actionhelperpaths.My_Action_Helper =
APPLICATION_PATH "/controllers/helpers"
If you use the above configuration, you won't need to define the helper
paths within your own class resource method.
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/