DevShed has the latest in their "User-defined interfaces in PHP5" series posted today - Implementing (X)HTML Widgets - a look at how to create bits of reusable code (widgets) to help make your development process more object oriented.
The drawback to the "widget" approach resides mainly in the performance cost of creating many objects for rendering a web document, even if they only exist until the page has finished displaying.
In this second part of the series, you will learn the basics of object-oriented web page generation through the use of (X)HTML widgets. You will also see how objects implement the "HTMLRenderer" interface to explicitly define its functionality by using the "toHTML()" method.
They jump right in, creating the base for their widgets, the HTMLRenderer interface. From there, they show how to create the widget classes and interface them in with the HTMLRenderer (which provides a generic interface and the toHTML function for the widget subclasses).