|
|||
|
Hi, I'm looking for a quick tutorial on subclassing the action controller. The docs (Zend Framework: Documentation) don't say very much about it.
Basically, I'm realizing I'm repeating a bit of code every time I create a new controller. I would like to include the following function in the base controller that extends the zend_controller_action which I could then extend it with my normal page controllers. For example, I would like all of my controllers to have the following function: public function init() { $this->view->baseUrl = $this->_request->getBaseUrl(); } Thanks! |
|
|||
|
Thanks Xentek for the help. I'm hoping you don't mind lending your expertise once again. Over in this thread I had some issues with pathing. And I thought they were solved. Here's issue:
I currently have the following structure: /library/Erik/controllers /library/Erik/forms /library/Zend/ In my indexAction, I am able to require_once 'form/myNewForm' without any issues. However, when I attempt to require_once 'controllers/BaseControllers/ PHP throws an error (can't find the file). Any ideas...it's maddening! |
|
|||
|
Well, naming your application directory "library" seems like a bad start, as one could take that to mean that the directory actually houses the thing that most resembles a library, that is, the Zend Framework. It also sounds like you're having simple include_path issues. Basically you need to have an entry in your include_path for every directory you're going to be including files from, or just use the path when actually including the file.
PHP: Description of core php.ini directives - Manual PHP: set_include_path - Manual |
|
|||
|
My understanding is that he WAS referring to the library directory not the application directory. notice he also included '/library/Zend/'
|
|
||||
|
@ehalber
I agree with KMG... I think you may want to rethink your dir structure and check out the autoLoader. The only thing I'm putting my library directory, besides Zend is other third-party libraries I'm using.
__________________
- xentek |
![]() |
| Thread Tools | |
| Display Modes | |
|
|