I'm new to zend framework and I want to ask if is it possible to have a base controller that will be extended by all other controllers? I want to have a base class wherein I'll put all common methods and properties for all controllers I'll have on my project. Is it advisable to do this with zend or is there a better approach to this?
+3
A:
You could just make a base class which extends Zend_Controller_Action. Then use that as the base class for all of your controllers.
Although, depending on what you want to do, it might be more appropriate to make Action helpers for the kind of functionality you want in every controller.
Pro777
2009-12-18 15:16:48
Either of Pro777's options are valid. Helpers are preferred because they are loaded as needed. Whereas if you make a custom instance of Zend_Controller_Action, all of your functions will be loaded for every page view.
Mark
2009-12-18 16:08:20
+1 You can extend `Zend_Controller_Action` and create a base class, but as Mark said the use of Action Helpers is the preferred way.
Luiz Damim
2009-12-18 17:03:26
i really appreciate all your input. they all make sense to me. i guess i'll try to read on what action helpers are and how to use them. thanks guys :-)
ist
2009-12-19 13:05:52