php - Is a good idea have a BaseController and make all controllers extend that class? -


i need common behaviors in controllers. idea have basecontroller , make controllers extend class? if so, correct way avoid fatal error: class 'basecontroller' not found error.

it's common approach.

but article zf project lead matthew weier o'phinney explains how action-helpers can provide same benefits more flexibility.

in particular, common base controller becomes dumping ground functionality used in multiple-but-not-all controllers, become overkill. action-helpers kind of lazy-load alternative, invoking functionality precisely when , need it.

also, action-helper dispatch hooks - init(), predispatch() , postdispatch() - allow automate plugin-like functionality on per-controller basis.

i'd go action-helpers. things, ymmv. ;-)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -