php-doc-en/reference/tidy/reference.xml

170 lines
4.9 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.9 $ -->
<!-- Purpose: basic.other -->
<!-- Membership: pecl, bundled, external -->
<reference id="ref.tidy">
<title>Tidy Functions</title>
<titleabbrev>tidy</titleabbrev>
<partintro>
<section id="tidy.intro">
&reftitle.intro;
<para>
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.
</para>
</section>
<section id="tidy.requirements">
&reftitle.required;
<para>
To use Tidy, you will need libtidy installed, available
on the tidy homepage <ulink url="&url.tidy;">&url.tidy;</ulink>.
</para>
</section>
&reference.tidy.configure;
&reference.tidy.ini;
<section id="tidy.resources">
&reftitle.resources;
&no.resource;
</section>
<section id='tidy.classes'>
&reftitle.classes;
<section id='tidy.class.tidynode'>
<title><classname>tidyNode</classname></title>
<section id='tidy.class.tidynode.methods'>
&reftitle.methods;
<itemizedlist>
<listitem>
<para><xref linkend='function.tidyNode-hasChildren' /> - Returns &true; if the current node has childrens</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-hasSiblings' /> - Returns &true; if the current node has siblings</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-isAsp' /> - Returns &true; if the current node is ASP code</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-isComment' /> - Returns &true; if the current node is a comment</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-isHtml' /> - Returns &true; if the current node is HTML</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-isJste' /> - Returns &true; if the current node is JSTE</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-isPhp' /> - Returns &true; if the current node is PHP</para>
</listitem>
<listitem>
<para><xref linkend='function.tidyNode-isText' /> - Returns &true; if the current node is Text (no markup)</para>
</listitem>
</itemizedlist>
</section>
<section id='tidy.class.tidynode.properties'>
&reftitle.properties;
<itemizedlist>
<listitem>
<para>value - the value of the node (e.g. the html text)</para>
</listitem>
<listitem>
<para>name - the name of the tag (e.g. html, a, etc..)</para>
</listitem>
<listitem>
<para>type - the type of the node (one of the constants above, e.g. <constant>TIDY_NODETYPE_PHP</constant>)</para>
</listitem>
<listitem>
<para>line* - the line where the node starts</para>
</listitem>
<listitem>
<para>column* - the column where the node starts</para>
</listitem>
<listitem>
<para>proprietary* - &true; if the node refers to a proprietary tag</para>
</listitem>
<listitem>
<para>id - the ID of the tag (one of the constants above, e.g. <constant>TIDY_TAG_FRAME</constant>)</para>
</listitem>
<listitem>
<para>attribute - an array with the attributes of the current node, or &null; if there aren't any</para>
</listitem>
<listitem>
<para>child - an array with the child <type>tidyNode</type>s, or &null; if there aren't any</para>
</listitem>
</itemizedlist>
<note>
<para>
The properties marked with * are just available since PHP 5.1.0.
</para>
</note>
</section>
</section>
</section>
&reference.tidy.constants;
<section id="tidy.examples">
&reftitle.examples;
<para>
This simple example shows basic Tidy usage.
<example>
<title>Basic Tidy usage</title>
<programlisting role="php">
<![CDATA[
<?php
ob_start();
?>
<html>a html document</html>
<?
$html = ob_get_clean();
// Specify configuration
$config = array(
'indent' => true,
'output-xhtml' => true,
'wrap' => 200);
// Tidy
$tidy = new tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
// Output
echo $tidy;
?>
]]>
</programlisting>
</example>
</para>
</section>
</partintro>
&reference.tidy.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->