|
8.131.13 tidy::__construct()
Construit un nouvel objet Tidy
[ Exemples avec tidy_construct ] CVS uniquement
tidy
tidy::__construct (
string
filename
,
mixed
config
,
string
encoding
,
bool
use_include_path
)
tidy::__construct
construit un nouvel objet Tidy.
Si le paramètre
filename
est fourni, cette fonction
lira également ce fichier et initialisera l'objet avec ce fichier, agissant de la même façon
que la fonction
tidy_parse_file
.
Le paramètre
config
peut
prendre la forme d'un tableau ou d'une chaîne de caractères. Sous forme
de chaîne, il représente le nom du fichier de configuration et sinon, c'est
un tableau avec les options de configuration. Lisez http://tidy.sourceforge.net/docs/quickref.php pour en savoir plus sur chaque
option.
Le paramètre
encoding
spécifie le jeu de caractères
utilisé pour les documents en entrées et sorties. Les valeurs possibles de
encoding
sont :
ascii, latin0, latin1, raw, utf8, iso2022, mac, win1252, ibm858, utf16,
utf16le, utf16be, big5 et shiftjis.
| Exemple avec tidy::__construct |
<?php
$html = <<< HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head><title>title</title></head> <body> <p>paragraph <bt /> text</p> </body></html>
HTML;
$tidy = new tidy; $tidy->parseString($html);
$tidy->CleanRepair();
if ($tidy->errorBuffer) { echo "Les erreurs suivantes ont été détectées :\n"; echo $tidy->errorBuffer; }
?>
|
Voir aussi
tidy_parse_file
et
tidy_parse_string
.
|