<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="tidy.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>tidy::__construct</refname>
  <refpurpose>Constructs a new <classname>tidy</classname> object</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <constructorsynopsis role="tidy">
   <modifier>public</modifier> <methodname>tidy::__construct</methodname>
   <methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>filename</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type class="union"><type>array</type><type>string</type><type>null</type></type><parameter>config</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>encoding</parameter><initializer>&null;</initializer></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>useIncludePath</parameter><initializer>&false;</initializer></methodparam>
  </constructorsynopsis>
  <para>
   Constructs a new <classname>tidy</classname> object.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>filename</parameter></term>
     <listitem>
      <para>
       If the <parameter>filename</parameter> parameter is given, this function
       will also read that file and initialize the object with the file,
       acting like <function>tidy_parse_file</function>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>config</parameter></term>
     <listitem>
      <para>
       The config <parameter>config</parameter> can be passed either as an
       array or as a string. If a string is passed, it is interpreted as the
       name of the configuration file, otherwise, it is interpreted as the
       options themselves.
      </para>
      <para>
       For an explanation about each option, visit <link xlink:href="&url.tidy.conf;">&url.tidy.conf;</link>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>encoding</parameter></term>
     <listitem>
      <para>
       The <parameter>encoding</parameter> parameter sets the encoding for
       input/output documents. The possible values for encoding  are: 
       <literal>ascii</literal>, <literal>latin0</literal>, <literal>latin1</literal>,
       <literal>raw</literal>, <literal>utf8</literal>, <literal>iso2022</literal>,
       <literal>mac</literal>, <literal>win1252</literal>, <literal>ibm858</literal>,
       <literal>utf16</literal>, <literal>utf16le</literal>, <literal>utf16be</literal>,
       <literal>big5</literal>, and <literal>shiftjis</literal>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>useIncludePath</parameter></term>
     <listitem>
      <para>
       Search for the file in the <link linkend="ini.include-path">include_path</link>.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry>8.0.0</entry>
      <entry>
       <parameter>filename</parameter>, <parameter>config</parameter>,
       <parameter>encoding</parameter> and <parameter>useIncludePath</parameter> are nullable now.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>tidy::__construct</function> example</title>
    <programlisting role="php">
<![CDATA[
<?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 "The following errors were detected:\n";
    echo $tidy->errorBuffer;
}

?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
The following errors were detected:
line 8 column 14 - Error: <bt> is not recognized!
line 8 column 14 - Warning: discarding unexpected <bt>
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>tidy::parseFile</function></member>
   <member><function>tidy::parseString</function></member>
  </simplelist>
 </refsect1>

</refentry>
<!-- 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:"~/.phpdoc/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
-->
