PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Fonctions Tidy> <Constantes pré-définies
Last updated: Fri, 03 Oct 2008

view this page in

Exemples

Exemples

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;
?>



add a note add a note User Contributed Notes
Exemples
dan [@t] authenticdesign [d_o_t] net
22-Aug-2008 07:44
If you're just looking for a quick and dirty way to output HTML code you created in a formatted way use this technique...

<?php
$html
= 'a chunk of html you created';
$config = array(
           
'indent'         => true,
           
'output-xml'     => true,
           
'input-xml'     => true,
           
'wrap'         => '1000');

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

... This seemed to get the result I wanted every time.

Fonctions Tidy> <Constantes pré-définies
Last updated: Fri, 03 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites