Exemple Tidy

Ce simple exemple montre l'utilisation de base de Tidy.

Exemple #1 Utilisation de base de Tidy

<?php
ob_start
();
?>
<html>un document HTML</html>
<?php
$html 
ob_get_clean();

// Configuration
$config = array(
           
'indent'         => true,
           
'output-xhtml'   => true,
           
'wrap'           => 200);

// Tidy
$tidy = new tidy;
$tidy->parseString($html$config'utf8');
$tidy->cleanRepair();

// Affichage
echo $tidy;
?>