I've read somewhere that using a base controller is bad and that there are more down sides than up sides. That person said that you should use plugins.
What I need is before every action get from the request the "lang" variable and pass it to the current action. What I've done now is making a base controller with preDispatch that gets it from the request and passes it through $this
(any other controller extends from the base).
How should I implement it if I'd use plugins? And should I?
EDIT: Found the place where I've read that base controllers are evil: Sending variables to the layout in Zend Framework comment on the last answer. Notice that my question is not similar (I need to pass to an action, not to the layout).
EDIT2: With your answers on how to implement, could you also include an explanation why using a base controller is bad?
EDIT3:
Can't seem to make it work. I've done: created a helpers dir in the controllers folder, added in the initializer Zend_Controller_Action_HelperBroker::addPath('../application/default/controllers/helpers/', 'Controller_Helper');
Created a file in that folder called LangHelper.php and created a class Controller_Helper_Lang extends Zend_Controller_Action_Helper_Abstract
. Why doesn't it yet work? (maybe I need to add a require once or something?)
EDIT4: What I get is:
Zend_Loader_PluginLoader_Exception: Plugin by name 'Lang' was not found in the registry; used paths: Controller_Helper_: ../application/default/controllers/helpers/;../application/admin/controllers/helpers/ Zend_Controller_Action_Helper_: Zend/Controller/Action/Helper/ in C:\wamp\www\EfCom\library\Zend\Loader\PluginLoader.php on line 412