News Feed
Sections




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

DevShed:
Working with Template Classes in PHP 5
March 19, 2007 @ 12:06:00

DevShed looks at another in their series of design patterns with this new article - a look at one of the simpler, more popular methods, the Template pattern.

A template class is a base class with some special abilities. First, it concretely implements one or more algorithms; second, it can determine which subclasses should use these algorithms. This article is the first part of a two-part series that introduces you to the basic concepts of this design pattern.

They create two simple classes that interface with MySQL to grab the template data from the database. On top of this, they build out a version of teh Template class, a set of methods to grab the formatted rows and return them back to the script. Finally, they use these results with a few helper classes (one for paragraphs, one for div tags) and create an example that outputs the formatted database information.

0 comments voice your opinion now!
template designpattern example tutorial html output database template designpattern example tutorial html output database


blog comments powered by Disqus

Similar Posts

Symfony Blog: How to send emails in symfony 1.1

Stuart Herbert's Blog: Microsoft's First PHP Extension: SQL Server 2005 Support

Web Developement Blog: Curl: Location redirect while open_basedir is set

NetTuts.com: Build Web Apps From Scratch With Laravel: Filters, Validations, and Files

PHPro.org: SPL AppendIterator


Community Events





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


release series api laravel bugfix framework zendserver list interview development threedevsandamaybe deployment tips podcast conference community code language introduction voicesoftheelephpant

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