Home arrow PHP arrow User-defined Interfaces in PHP 5: Building a Page Generator

User-defined Interfaces in PHP 5: Building a Page Generator

In this final part of the series on user-defined interfaces in PHP 5, Alejandro puts all of the classes created in the previous articles together to work as a page generator. This allows complex page generation to be translated into a more flexible process through an object-based solution.

  1. User-defined Interfaces in PHP 5: Building a Page Generator
  2. Working with multiple interface implementers: defining a page generator class
  3. Building object-based web pages: implementing the “PageGenerator” class
  4. Full source code: listing the complete classes
By: Alejandro Gervasio
Rating: starstarstarstarstar / 12
January 09, 2006

print this article




Here we are again. Welcome to the last part of the series “User-defined interfaces in PHP5.” Although the subject is certainly thorough enough to be the topic of a complete book chapter, this series has hopefully served as an introduction to learning the basics of interfaces, as well as demonstrated how these programming structures can be used within real applications, such as those aimed at generating web pages by utilizing an object-oriented method.

By way of refreshing the concepts deployed in the previous article, I wrote two MySQL-processing classes that illustrated the use of the “HTMLRenderer” interface. They implemented the interface on result-type objects, and delivered fully-formatted result sets that could be easily integrated with minor difficulties into web page generation systems.

Of course the implementation of interfaces made through MySQL-processing classes along with (X)HTML widgets has clearly proven how objects of different family types can be easily grouped through the same set of abstract methods, which have a specific definition within each pertaining class.

Indeed, PHP5 provides web programmers with long awaited object-oriented features, such as support for interfaces, type hinting, abstract classes, and so forth, along with a powerful standard package (the Standard PHP Library), primarily intended to supply pre-built libraries for avoiding the so-called wheel reinvention.

With reference to this final part of the series, I shall put all of the classes to work together into a full-featured example, by including the already familiar (X)HTML widgets in conjunction with the pair of MySQL-processing classes, in order to integrate both types of objects into a page generator class. As a result, complex web page generation can be translated into a more flexible process tackled through an object-based solution. Let’s go!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: