 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Patterns for Flexible View Handling, Part 1 - Working with Composites
by Chris Cornutt August 30, 2012 @ 08:32:36
PHPMaster.com has started up a new series today with the first part of a set of tutorials looking at design patterns that can be used in the handling of your views to make them more effective and easier to maintain.
To overcome your skepticism [of an easy to use, flexible view system], in this two-part tutorial I'll show you how to implement from scratch a couple of customizable view handling modules by sinking our teeth into the goodies of the Composite and Decorator patterns.
He starts off by creating a foundation to work from - a basic View class that takes in data, allows for the setting of a template and combines it all together when "render()" is called. He then takes this example and applies the Composite pattern and creates interfaces for the template, container and view, implements them and shows how to attach views to other views. Each of these views is then rendered when the main "render()" method is called and the output is appended.
voice your opinion now!
view handling mvc composite designpattern tutorial
Ralph Schindler's Blog: Composite Rowsets For Many-To-Many Relationships Via Zend_Db_Table
by Chris Cornutt November 16, 2010 @ 11:08:24
Ralph Schindler has posted a handy tutorial (along with some helpful code) to his blog today about handling many-to-many composite rowset relationships with the Zend_Db component of the Zend Framework.
One of the hardest problems to solve when developing an ORM of any complexity is in deciding how to handle the retrieval of rows that satisfy a many-to-many relationship, also known as a M:N relationship. [...] To model M:N relationships, database developers must get creative. By employing the use of a "3rd party", and by utilizing foreign keys that model a 1:N relationship, database developers can model a M:N relationship.
He looks at the Zend_Db_Table_Row class of the framework and how it works with these junction tables and how it has an issue where it returns the junction table columns too. A fix was released (in 1.10.2) for the framework to work correctly. Unfortunately, this also left those using the method out in the cold. So, Ralph has created his own workaround called a composite rowset. He includes an example snippet to give you an idea of how it works, but you can download the code from his github repository for a closer look.
voice your opinion now!
composite rowset zendframework zenddbtable manytomany database
Rob Zienert's Blog: Zend_Form Decorators and Composite Elements
by Chris Cornutt June 23, 2010 @ 12:50:12
Rob Zienert has a new post to his blog today looking at Zend_Form decorators and composite elements to make for more powerful forms in your Zend Framework application.
Today had quite a number of Zend_Form-related questions in #zftalk. Everything from Decorators to Composite Elements, you know - the usual Zend_Form questions. What better way to answering questions than with a blog post and some sample code?
His illustration of decorators shows how to put each of the form elements inside of a "DI" tag to help makes the lives of the frontend developers that much simpler. For the composite elements he shows how to use them to group a set of selects into one object that is then validated through Zend_Date for valid date information. You can grab the code for each of these illustrations from this account on Github
voice your opinion now!
zendform decorators composite tutorial
Matthew Weier O'Phinney's Blog: Creating composite elements
by Chris Cornutt April 14, 2009 @ 10:25:53
Based on an example in a previous blog post (seen here) Matthew Weier O'Phinney wanted to clear a few things up on the "date of birth" element he had mocked up in his Zend_Form example.
In my last post on decorators, I had an example that showed rendering a "date of birth" element [...]. This has prompted some questions about how this element might be represented as a Zend_Form_Element, as well as how a decorator might be written to encapsulate this logic. Fortunately, I'd already planned to tackle those very subjects for this post!
To be able to use the element in its current state the key lies in the setValue method. More correctly in the overriding of the setValue method. He includes an example class that is smart enough to use that custom form element. It has get and set methods for each of the date fields (month/day/year) and the set/getValue methods that can interact using them. He wraps this all up inside a form decorator and creates an instance of the Date element to help create and handle the properties it has.
voice your opinion now!
create composite element date zendform decorator custom
DevShed: Working with Strings and the Composite Pattern in PHP 5
by Chris Cornutt March 14, 2007 @ 11:14:00
DevShed has posted the second and last part of a series of two articles based around the Composite design pattern - using it to work with strings in PHP5.
Are you a PHP developer who wants to improve your skills in pattern-based programming in PHP? If the answer to this question is a emphatic yes, then you should begin reading this article now! Welcome to the final part of the series "Implementing the composite pattern with PHP 5." Comprised of two instructive tutorials, this series walks you through the basic concepts of this important design pattern, and shows you how to apply it with some educational examples.
They start by defining a simple StringProcessor class as an abstract interface to build from. From there, they create two other classes - the SingleStringProcessor and the MultipleStringProcessor. Each of these takes in either a single file or multiple filenames and spits back out the value of the string and the length of the string.
voice your opinion now!
tutorial composite designpattern strings single multiple tutorial composite designpattern strings single multiple
DevShed: Introducing the Composite Pattern in PHP 5
by Chris Cornutt March 09, 2007 @ 09:33:00
Continuing their look at design patterns, DevShed has kicked off yet another series today spotlighting the Composite pattern as used in PHP5.
The composite pattern is one of the less commonly used patterns in PHP 5. Nevertheless, in certain situations, it is very helpful. This article, the first one in a two-part series, will introduce you to the basic concepts of the composite pattern.
The composite pattern allows you to define a single or multiple objects that will have identical behavior - basically behaving the same if there's just one or with the multiple instances. They start with the basics, reaching for one of their standard examples - a file information reader - to illustrate their point. They create the two helper classes it needs to work, one for the single file read and another for the multiple file read. The finish by combining them all together for a file-reading fiesta, showing how to get a one shot info dose as well adding files to the list and grabbing their info all together.
voice your opinion now!
introduction tutorial php5 designpattern composite object single multiple introduction tutorial php5 designpattern composite object single multiple
|
Community Events
Don't see your event here? Let us know!
|