As a PHP developer, you've probably developed database-driven applications that deliver their contents in (X)HTML format to the end user. If so, you know that when you work directly with hard-coded (X)HTML files, you risk forgetting to close tags and DTD headers, making the process annoying and time-consuming. Keep reading; help is on the way.
As you know, hand-coding (X)HTML files certainly forces your PHP applications to have a clean and tight presentation layer, but actually giving your code this quality comes at a cost. You'll need to verify that all those files have been created in the correct format. Is there any way to make this process as painless as possible?
Of course there is! If you've ever worked with code editors like Home Site and Dreamweaver MX, to name just two, then you'll recall that all of them incorporate the popular Tidy application as part of their arsenal of code-cleaning tools. It's extremely useful for correcting rapidly any errors that have occurred while coding (X)HTML files.
However, the real good news about Tidy is that you can take advantage of its neat features by accessing it from your PHP files, since this excellent code-cleaning package is now available as an external library in PHP 5. This means that you can correct any source (X)HTML files very efficiently and with minor hassles.
Thus, now that you know that the Tidy (X)HTML formatting/correcting application can be called directly from your own PHP 5 scripts, over the course of this series, which is comprised of three friendly tutorials, I'm going to walk you through using the bunch of useful functions included with this library. Naturally I'll accompany the corresponding theory with a decent number of code samples, so you can learn quickly how to make this PHP extension work for you in a very short time.
Now, it's time to get rid of the preliminaries and start learning how to work with the Tidy library and PHP 5. Let's go!