News Feed
Sections




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

DevShed:
Generating Web Pages with the Flyweight Pattern in PHP 5
March 05, 2007 @ 12:19:00

DevShed concludes their look at the Flyweight pattern with this new tutorial - the second part focusing on building an actual application with the pattern implemented.

In this final part of the series, I'm going to teach you in a step-by-step format how to create in PHP 5 a flyweight class to balance the instantiation of objects that will be used to generate web documents on the fly. Hopefully, by the end of this article, you should have acquired a considerable background in how to apply the flyweight pattern in a real-world situation.

They create a simple application that generates dynamic HTML elements - DIV tags - with a simple interface to define things like content, name, and ID. Their Flyweight factory class creates and manages the number of DIVs that are created, blocking requests for any more. Finally, they apply it, showing the creation of a simple web page with multiple DIVs in it.

0 comments voice your opinion now!
tutorial flyweight designpattern html element dynamic application tutorial flyweight designpattern html element dynamic application


blog comments powered by Disqus

Similar Posts

Tim Koschuetzki's Blog: How To Transform HTML To Textile Markup - The CakePHP TextileHelper Revisite

BinaryTides.com: Javascript style object literals in PHP

Hasin Hayder's Blog: Getting started with orchid framework

ScreenFony.com: Work with bootstrap, assetic and less

Ivan Iordanov's Blog: extending Zend_Db_Table to create NestedSet models


Community Events





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


developer api install language podcast laravel testing opinion code introduction series framework threedevsandamaybe interview list symfony2 community unittest refactor release

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