Re: [fw-general] Of 3 methods to centralize code used in all/many controllers which do you use when?
On Tuesday 16 June 2009 07:35:11 joedevon wrote: > The following question on Stack Overflow prompted this post: > > http://stackoverflow.com/questions/866367/how-do-i-centralize-code-from-my- >init-functions-in-all-controllers/866517 > > "How do I centralize code from my init functions in all controllers?" > > Three answers all work I believe: > > 1. Extend Zend_Controller_Action and have your controllers extend from > THERE > > 2. Write a plugin by extending Zend_Controller_Plugin_Abstract > > 3. Create an Action Helper > > I assume there are situations where each one of those is the best solution. > I've been doing answer 1 mostly, but thinking about switching to answer 3 > for future projects. > > But I'd like to know what the recommended situations are for each solution. You should note that "the plugin" is actually front controller plugin while "the helper" is the action controller helper. They have different scopes and purposes. -- Dado
Re: [fw-general] Of 3 methods to centralize code used in all/many controllers which do you use when?
why can't it be all three? seriously though, i'm doing mostly 1, then 3 and 2. On Tue, Jun 16, 2009 at 1:35 PM, joedevon wrote: > > The following question on Stack Overflow prompted this post: > > > http://stackoverflow.com/questions/866367/how-do-i-centralize-code-from-my-init-functions-in-all-controllers/866517 > > "How do I centralize code from my init functions in all controllers?" > > Three answers all work I believe: > > 1. Extend Zend_Controller_Action and have your controllers extend from > THERE > > 2. Write a plugin by extending Zend_Controller_Plugin_Abstract > > 3. Create an Action Helper > > I assume there are situations where each one of those is the best solution. > I've been doing answer 1 mostly, but thinking about switching to answer 3 > for future projects. > > But I'd like to know what the recommended situations are for each solution. > > Thanks. > -- > View this message in context: > http://www.nabble.com/Of-3-methods-to-centralize-code-used-in-all-many-controllers-which-do-you-use-when--tp24047991p24047991.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >