<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.tidy.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'tidy.parsefile.php',
    1 => 'tidy::parseFile',
    2 => 'Parse markup in file or URI',
  ),
  'up' => 
  array (
    0 => 'class.tidy.php',
    1 => 'tidy',
  ),
  'prev' => 
  array (
    0 => 'tidy.isxml.php',
    1 => 'tidy::isXml',
  ),
  'next' => 
  array (
    0 => 'tidy.parsestring.php',
    1 => 'tidy::parseString',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/tidy/tidy/parsefile.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="tidy.parsefile" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">tidy::parseFile</h1>
  <h1 class="refname">tidy_parse_file</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8, PECL tidy &gt;= 0.5.2)</p><p class="refpurpose"><span class="refname">tidy::parseFile</span> -- <span class="refname">tidy_parse_file</span> &mdash; <span class="dc-title">Parse markup in file or URI</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-tidy.parsefile-description">
  <h3 class="title">Опис</h3>
  <p class="para">Об&#039;єктно-орієнтований стиль</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>tidy::parseFile</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$config</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$useIncludePath</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">Процедурний стиль</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>tidy_parse_file</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$config</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$encoding</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$useIncludePath</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="class.tidy.php" class="type tidy">tidy</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Parses the given file.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-tidy.parsefile-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       If the <code class="parameter">filename</code> parameter is given, this function
       will also read that file and initialize the object with the file,
       acting like <span class="function"><strong>tidy_parse_file()</strong></span>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">config</code></dt>
     <dd>
      <p class="para">
       The config <code class="parameter">config</code> 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.
      </p>
      <p class="para">
       For an explanation about each option, see
       <a href="http://api.html-tidy.org/#quick-reference" class="link external">&raquo;&nbsp;http://api.html-tidy.org/#quick-reference</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">encoding</code></dt>
     <dd>
      <p class="para">
       The <code class="parameter">encoding</code> parameter sets the encoding for
       input/output documents. The possible values for encoding  are: 
       <code class="literal">ascii</code>, <code class="literal">latin0</code>, <code class="literal">latin1</code>,
       <code class="literal">raw</code>, <code class="literal">utf8</code>, <code class="literal">iso2022</code>,
       <code class="literal">mac</code>, <code class="literal">win1252</code>, <code class="literal">ibm858</code>,
       <code class="literal">utf16</code>, <code class="literal">utf16le</code>, <code class="literal">utf16be</code>,
       <code class="literal">big5</code>, and <code class="literal">shiftjis</code>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">useIncludePath</code></dt>
     <dd>
      <p class="para">
       Search for the file in the <a href="ini.core.php#ini.include-path" class="link">include_path</a>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-tidy.parsefile-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   <span class="methodname"><strong>tidy::parseFile()</strong></span> returns <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> on success.
   <span class="function"><strong>tidy_parse_file()</strong></span> returns a new <span class="classname"><a href="class.tidy.php" class="classname">tidy</a></span>
   instance on success.
   Both, the method and the function return <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-tidy.parsefile-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">config</code> and <code class="parameter">encoding</code> are nullable now.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-tidy.parsefile-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>tidy::parseFile()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$tidy </span><span style="color: #007700">= new </span><span style="color: #0000BB">tidy</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">parseFile</span><span style="color: #007700">(</span><span style="color: #DD0000">'file.html'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cleanRepair</span><span style="color: #007700">();<br /><br />if(!empty(</span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorBuffer</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">"The following errors or warnings occurred:\n"</span><span style="color: #007700">;<br />    echo </span><span style="color: #0000BB">$tidy</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">errorBuffer</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-tidy.parsefile-seealso">
  <h3 class="title">Прогляньте також</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="tidy.parsestring.php" class="function" rel="rdfs-seeAlso">tidy::parseString()</a> - Parse a document stored in a string</span></li>
   <li><span class="function"><a href="tidy.repairfile.php" class="function" rel="rdfs-seeAlso">tidy::repairFile()</a> - Repair a file and return it as a string</span></li>
   <li><span class="function"><a href="tidy.repairstring.php" class="function" rel="rdfs-seeAlso">tidy::repairString()</a> - Repair a string using an optionally provided configuration file</span></li>
  </ul>
 </div>

 
</div><?php manual_footer($setup); ?>