Once you understand all the basic concepts of writing programs, the practice of software development can sometimes devolve into a simple exercise in pattern recognition. If you catch yourself writing the same code more than once or twice, you’re probably doing something wrong. Here’s an example that will apply particularly to those of us who use the Zend Framework.
Typically, in a web application following MVC design principles, there are patterns that emerge from your actions. Patterns like access control, detecting special requests and responding appropriately, preparing pagination controls, etc. The Zend Framework and other frameworks provide abstract classes to handle the basics, but they’re meant to be extended to suit your own application.
Make sure you have your own ./library folder within your application that’s on your php include path and create a directory structure for your extended action class beginning with a namespace of your choice. I’m using Crozz. Here’s a skeleton that I’ve paced in ./library/Crozz/Controller/Action.php: