News Feed
Sections




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

PHPMaster.com:
Patterns for Flexible View Handling, Part 2 - Using Decorators
September 05, 2012 @ 11:18:58

PHPMaster.com has posted the second part in their series looking at design patterns in handling views in your framework of choice. In this new article they focus on the decorator pattern, using additional functionality to augment the results from the view being rendered.

It's also feasible to manipulate views in fairly flexible fashion by appealing to the niceties of a few other patterns as well, including the rather underrated Decorators. If you're wondering in what parallel universe Decorators get along with views, in this part I'll be showing how to put them to work side by side in nice orchestration to bring to life yet another view module.

They create a simple example where an HTML element (based on an interface) is rendered - a span tag - with content passed in on creation. They take this same logic and transfer it over to the View handler, making handlers for difference pieces of the content (outer and inner). These decorators are then passed in the data from the view and rendered in order.

0 comments voice your opinion now!
designpattern view handling decorator tutorial


blog comments powered by Disqus

Similar Posts

DevX.com: Add the Graphics Power of SVG to PHP

PHP-Coding-Practices.com: The Opening Of A New PHP Directory!

Josh Adell's Blog: Command Invoker Pattern with the Open/Closed Principle

Zend Developer Zone: The ZendCon Sessions Episode 24: Elegant Ways of Handling PHP Errors and Except

Brian Swan's Blog: Creating PHP Websites with WebMatrix


Community Events





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


interview podcast developer laravel release threedevsandamaybe series framework project application language configure code bugfix api wordpress list introduction library community

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