Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 12341

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Parse markup in file or URI</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tidy.isxml.html">tidy::isXml</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="tidy.parsestring.html">tidy::parseString</a></div>
 <div class="up"><a href="class.tidy.html">tidy</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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, 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">Description</h3>
  <p class="para">Object oriented style</p>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>tidy::parseFile</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$config</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$use_include_path</code><span class="initializer"> = false</span></span>
  ]]] )</div>

  <p class="para rdfs-comment">Procedural style</p>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="class.tidy.html" class="type tidy">tidy</a></span> <span class="methodname"><strong>tidy_parse_file</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$config</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code></span>
   [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$use_include_path</code><span class="initializer"> = false</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">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">filename</code></em></span>
     <dd>

      <p class="para">
       If the <em><code class="parameter">filename</code></em> 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>

    <dt>

     <span class="term"><em><code class="parameter">config</code></em></span>
     <dd>

      <p class="para">
       The config <em><code class="parameter">config</code></em> 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://tidy.sourceforge.net/docs/quickref.html" class="link external">&raquo;&nbsp;http://tidy.sourceforge.net/docs/quickref.html</a>.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">encoding</code></em></span>
     <dd>

      <p class="para">
       The <em><code class="parameter">encoding</code></em> parameter sets the encoding for
       input/output documents. The possible values for encoding  are: 
       <em>ascii</em>, <em>latin0</em>, <em>latin1</em>,
       <em>raw</em>, <em>utf8</em>, <em>iso2022</em>,
       <em>mac</em>, <em>win1252</em>, <em>ibm858</em>,
       <em>utf16</em>, <em>utf16le</em>, <em>utf16be</em>,
       <em>big5</em>, and <em>shiftjis</em>.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">use_include_path</code></em></span>
     <dd>

      <p class="para">
       Search for the file in the <a href="ini.core.html#ini.include-path" class="link">include_path</a>.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-tidy.parsefile-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-tidy.parsefile-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-4055">
    <p><strong>Example #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&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</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">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;following&nbsp;errors&nbsp;or&nbsp;warnings&nbsp;occurred:\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</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 notes" id="refsect1-tidy.parsefile-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">The optional parameters
<em><code class="parameter">config</code></em> and <em><code class="parameter">encoding</code></em> were
added in Tidy 2.0.</span></p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-tidy.parsefile-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member"> <span class="function"><a href="tidy.parsestring.html" class="function" rel="rdfs-seeAlso">tidy::parsestring()</a> - Parse a document stored in a string</span></li>
   <li class="member"> <span class="function"><a href="tidy.repairfile.html" class="function" rel="rdfs-seeAlso">tidy::repairfile()</a> - Repair a file and return it as a string</span></li>
   <li class="member"> <span class="function"><a href="tidy.repairstring.html" class="function" rel="rdfs-seeAlso">tidy::repairstring()</a> - Repair a string using an optionally provided configuration file</span></li>
  </ul>
 </div>

 
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="tidy.isxml.html">tidy::isXml</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="tidy.parsestring.html">tidy::parseString</a></div>
 <div class="up"><a href="class.tidy.html">tidy</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>