Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > contrib-release > by-pkgid > 00062d9a138a4f480a29c418b9a4f3c1 > files > 15

php-pear-HTML_CSS-1.1.3-1mdv2008.1.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>
      Parse a file contents
    </title>
    <link rel="stylesheet" href="book.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" />
    <link rel="start" href="index.html" title="HTML_CSS Manual" />
    <link rel="up" href="ch05.html" title=
    "Chapter&nbsp;5.&nbsp;Parsing data sources" />
    <link rel="prev" href="ch05s02.html" title="Parse a simple string" />
    <link rel="next" href="ch05s04.html" title="Parse multi data sources " />
<style type="text/css">
/*<![CDATA[*/
 body {
  background-color: white;
  color: black;
 }
 :link { color: #0000FF }
 :visited { color: #840084 }
 :active { color: #0000FF }
 div.c3 {margin-left: 0.5in; margin-right: 0.5in;}
 div.c2 {font-family: monospace;}
 h2.c1 {clear: both}
/*]]>*/
</style>
  </head>
  <body>
    <table class="htmlcssHeader">
      <tr>
        <td>
          <img src="img/pearsmall.gif" align="left" alt="PEAR logo" />
          <h1>
            HTML_CSS : The Definitive Guide
          </h1>
          <div class="navheader">
            <table width="100%" summary="Navigation header">
              <tr>
                <th colspan="3" align="center">
                  Parse a file contents
                </th>
              </tr>
              <tr>
                <td width="20%" align="left">
                  <a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;
                </td>
                <th width="60%" align="center">
                  Chapter&nbsp;5.&nbsp;Parsing data sources
                </th>
                <td width="20%" align="right">
                  &nbsp;<a accesskey="n" href="ch05s04.html">Next</a>
                </td>
              </tr>
            </table>
          </div><br />
          <br />
        </td>
      </tr>
    </table>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <h2 class="title c1">
          <a name="developers.parse.file" id="developers.parse.file"></a>Parse
          a file contents
        </h2>
      </div>
      <p>
        Another quick way to create multiple selector definitions in one step
        is to use the <code class="methodname">HTML_CSS::parseFile()</code>
        function. CSS file to load is supposed to be W3C/CSS compliant.
      </p>
      <p>
        If previous selector definitions was into a file named 'styles.css',
        then to parse and load contents will be done with such script :
      </p>
      <div class="php c2">
        <ol>
          <li class="li1">
            <div class="de1">
              <span class="kw2">&lt;?php</span>
            </div>
          </li>
          <li class="li1">
            <div class="de1">
              <span class="kw1">require_once</span> <span class=
              "st0">'HTML/CSS.php'</span>;
            </div>
          </li>
          <li class="li1">
            <div class="de1">
              &nbsp;
            </div>
          </li>
          <li class="li1">
            <div class="de1">
              <span class="re0">$css</span> = <span class="kw2">new</span>
              HTML_CSS<span class="br0">(</span><span class="br0">)</span>;
            </div>
          </li>
          <li class="li1">
            <div class="de1">
              <span class="re0">$css</span>-&gt;<span class=
              "me1">parseFile</span><span class="br0">(</span><span class=
              "st0">'styles.css'</span><span class="br0">)</span>;
            </div>
          </li>
          <li class="li1">
            <div class="de1">
              <span class="re0">$css</span>-&gt;<span class=
              "me1">display</span><span class="br0">(</span><span class=
              "br0">)</span>;
            </div>
          </li>
          <li class="li1">
            <div class="de1">
              <span class="kw2">?&gt;</span>
            </div>
          </li>
        </ol>
      </div>
      <div class="tip c3">
        <table border="0" summary="Tip">
          <tr>
            <td rowspan="2" align="center" valign="top" width="48">
              <img alt="[Tip]" src="img/admons/tip.png" />
            </td>
            <th align="left">
              Tip
            </th>
          </tr>
          <tr>
            <td align="left" valign="top">
              If there are duplicate definitions into file contents, you should
              parse file with call :
              <div class="php c2">
                <ol>
                  <li class="li1">
                    <div class="de1">
                      <span class="kw2">&lt;?php</span>
                    </div>
                  </li>
                  <li class="li1">
                    <div class="de1">
                      <span class="re0">$css</span>-&gt;<span class=
                      "me1">parseFile</span><span class=
                      "br0">(</span><span class="st0">'styles.css'</span>,
                      <span class="kw2">true</span><span class="br0">)</span>;
                    </div>
                  </li>
                  <li class="li1">
                    <div class="de1">
                      <span class="kw2">?&gt;</span>
                    </div>
                  </li>
                </ol>
              </div>We will see next why we may find such duplicate
              definitions.
            </td>
          </tr>
        </table>
      </div>
    </div>
    <table class="htmlcssFooter">
      <tr>
        <td align="left">
          HTML_CSS : The Definitive Guide
        </td>
        <td align="right">
          v 1.1.3 : February 18, 2007
        </td>
      </tr>
    </table>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left">
            <a accesskey="p" href="ch05s02.html">Prev</a>&nbsp;
          </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ch05.html">Up</a>
          </td>
          <td width="40%" align="right">
            &nbsp;<a accesskey="n" href="ch05s04.html">Next</a>
          </td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">
            Parse a simple string&nbsp;
          </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top">
            &nbsp;Parse multi data sources
          </td>
        </tr>
      </table>
    </div>
  </body>
</html>