2010年11月24日星期三

[fw-mvc] best point in cycle to change default view script

I find I am repeating myself in controllers having actions named 'update'
and 'create,' because I want the default view script for those actions to be
'form'. I've discovered a hot tip about how you can do that in a controller:


$this->_helper->viewRenderer->setRender('form');

If you are pretty confident you'd like to do that application-wide, where's
a good place to set it up, rather than repeating yourself in controller
after controller? Obviously it has to take place after routing. Writing a
whole controller plugin just to do this one thing seems heavy-handed. What
do you think?

--
David Mintz
http://davidmintz.org/
It ain't over:
http://www.healthcare-now.org/

没有评论: