I have a code snippet that checks user logins and gets navigations and etc throughout the whole site. I have a few controllers and I want that snippet to be in all of them. I get tired of changing all of them one at a time whenever I change something. In one of my other projects I saw it somehow extended to the other controllers using this portion
class MyController extends Zend_Controller_Action
and it looked like
class MyController extends MySnippet_Controller_Action
or something of that sort, and it worked. I however can’t get that to work.
What you’re looking for is likely a frontcontroller plugin registered against init() or more likely predispatch(). In Zend Framework extending Zend_Controller_Action is frowned upon and in truth is not usually required.
these resources may help you develope the plugin(s) you need:
Understand ZF plugins pt 1
Understand ZF plugins pt 2
and of course the reference manual section
Here is the basic form of a plugin: