News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jani Hartikainen's Blog:
Reusable "generic" actions in Zend Framework
December 29, 2008 @ 07:55:13

In this recent blog entry Jani Hartikainen looks at the creation of generic actions for Zend Framework applications - methods that can be used to help eliminate code duplication:

Sometimes you will need nearly the same functionality in many actions. [...] There are several ways to deal with this, such as moving the code into a separate function, or an action helper. But in this post, I'm going to introduce so called "generic actions" - parametrized, easy to reuse actions - which is an idea similar to django generic views.

His example takes a generic action - one that grabs and output records from a table - and modifies it to take in parameters from the defining function as to which action/controller/model and ID to use. Then this action can be used over and over in multiple places without having to do any copy and paste coding.

0 comments voice your opinion now!
generic zction zend framework reuse duplicate


blog comments powered by Disqus

Similar Posts

The Bakery: Writing an easy to use A/B test helper with CakePHP and jquery

Sara Goleman\'s Blog: What the heck is TSRMLS_CC anyway?

Alexander Netkachev's Blog: Create Ajax Login page with Dojo toolkit and Zend Framework

Dave Marshall's Blog: ZFSnippets.com - Zend Framework Code Snippets

IBM developerWorks: Understanding the Zend Framework (Parts 5 & 6)


Community Events





Don't see your event here?
Let us know!


version interview podcast laravel language series artisanfiles tool introduction symfony release composer library list voicesoftheelephpant security conference opinion framework community

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework