|
|||
|
Hi,
as I said somewhere else before : I'm pretty new to the Zend Framework. So, here is another question I have. Where do I have to put an action helper considering Zend Framework best pratices? At default there is only a helpers path beneath the views path. I guess, that's the place for view helpers only, is it? What else do I have to beware of, so the helper gets loaded successfullly using $this->_helper->getHelper('MyBeautifulHelper') within the action controller. Any pitfall ?[edit] A small addition: I'm thinking of an action helper checking in an action controller, whether a user is logged in and may perform some action or not. [/edit] Thanks in advance for your help. Sebastian Last edited by sebastian : 04-16-2008 at 07:49 AM. |
|
|||
|
While I somewhat agree with Elemental I tend to separate my lib from my application. Meaning that things that aren't application specific ends up in the lib. Everything else ends up somewhere in the application. That way I end up with a neatly packaged reusable lib.
That being said I also have an application specific lib folder for application specific lib files(obviously). To answer your question I would create a helper dir in your controller dir (ie /modules/mymodule/controller/helpers/) and drop the helpers there. To call them you need to add the path tho, $this->_helper->addPath() from your controller for instance. Adding the path could/should be done elsewhere if it's a recurring thing. |
|
||||
|
That's an excellent idea. You could load the path based on the requested module via a plugin, much as you would a model. See this post for help with the plugin.
__________________
Zend Framework Resources: Zend Webinars | Reference Manual | API Docs | Books | FreeNode: #zftalk Getting Started Tutorials: Getting started with ZF | Getting started with Zend Auth |
![]() |
| Thread Tools | |
| Display Modes | |
|
|