News Feed
Sections




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

Benjamin Schneider's Blog:
Use PHP's Tidy extension to validate your (X)HTML markup
October 07, 2010 @ 10:59:30

In a new post to his blog Benjamin Schneider looks at how you can use the Tidy extension to clean up the (X)HTML markup that comes out of your application.

Tidy is a very cool PHP extension. You can let it tell you what kind of mistakes you might have in your HTML markup and even correct it for you - if you want. In my projects I use it to give me a hint if my generated markup is invalid. This way I can easily correct it during development without being dependent on external validators. In this post I will show you how easy it is and how few lines of code you need to make your application show any potential errors you might have in your HTML markup.

He shows how, with the help of output buffering, to grab the HTML output of your script and push it through the Tidy functionality (via a call to tidy_parse_string) and outputting the results. It even has a built in error catcher for when it finds invalid formatting in the generated markup. You can find out more about the features of this extension in the PHP manual.

0 comments voice your opinion now!
extension tidy markup html tutorial


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: Web Services Implementation using PHP and SOAP

DevShed: Using the Observer Design Pattern with Static Data in PHP 5

Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 2

Henrik Bjørnskov's Blog: Travis & Composer sitting in a tree K-I-S-S-I-N-G

onPHP5.com: Clickable, Obfuscated Email Addresses


Community Events





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


bugfix install language tips community series interview version framework podcast symfony deployment opinion library laravel release zendserver introduction update package

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