Tidy Functionstidy
&reftitle.intro;
Tidy is a binding for the Tidy HTML clean and repair utility which
allows you to not only clean and otherwise manipulate HTML documents,
but also traverse the document tree.
&reftitle.required;
To use Tidy, you will need libtidy installed, available
on the tidy homepage &url.tidy;.
&reference.tidy.configure;
&reference.tidy.ini;
&reftitle.resources;
&no.resource;
&reftitle.classes;
tidyNode
&reftitle.methods;
- Returns the parent of the current node - Returns &true; if the current node has children - Returns &true; if the current node has siblings - Returns &true; if the current node is ASP code - Returns &true; if the current node is a comment - Returns &true; if the current node is HTML - Returns &true; if the current node is JSTE - Returns &true; if the current node is PHP - Returns &true; if the current node is Text (no markup)
&reftitle.properties;
value - the value of the node (e.g. the html text)name - the name of the tag (e.g. html, a, etc..)type - the type of the node (one of the constants above, e.g. TIDY_NODETYPE_PHP)line* - the line where the node startscolumn* - the column where the node startsproprietary* - &true; if the node refers to a proprietary tagid - the ID of the tag (one of the constants above, e.g. TIDY_TAG_FRAME)attribute - an array with the attributes of the current node, or &null; if there aren't anychild - an array with the child tidyNodes, or &null; if there aren't any
The properties marked with * are just available since PHP 5.1.0.
&reference.tidy.constants;
&reftitle.examples;
This simple example shows basic Tidy usage.
Basic Tidy usage
a html document
true,
'output-xhtml' => true,
'wrap' => 200);
// Tidy
$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
// Output
echo $tidy;
?>
]]>
&reference.tidy.functions;