cvs: pear /HTML_CSS/docs/TDG ch09.html ch09s02.html ch09s03.html ch09s04.html ch09s05.html ch10.html ch10s02.html pt04.html re24.html

From: Date: Sat, 30 Dec 2006 12:51:47 +0000
Subject: cvs: pear /HTML_CSS/docs/TDG ch09.html ch09s02.html ch09s03.html ch09s04.html ch09s05.html ch10.html ch10s02.html pt04.html re24.html
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-43893@lists.php.net to get a copy of this message
farell Sat Dec 30 12:51:47 2006 UTC Added files: /pear/HTML_CSS/docs/TDG ch09.html ch09s02.html ch09s03.html ch09s04.html ch09s05.html ch10.html ch10s02.html pt04.html re24.html Log: new parts of manual 1.1.0

http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch09.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch09.html +++ pear/HTML_CSS/docs/TDG/ch09.html <?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> Chapter&nbsp;9.&nbsp;Error Handler </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="pt03.html" title= "Part&nbsp;III.&nbsp;Reference Guide" /> <link rel="prev" href="ch08s05.html" title= "Searching for selectors and/or properties" /> <link rel="next" href="ch09s02.html" title="Configuring a Handler " /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } div.c4 {font-family: monospace;} div.c3 {margin-left: 0.5in; margin-right: 0.5in;} h2.c2 {clear: both} p.c1 {font-weight: bold} /*]]>*/ </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"> Chapter&nbsp;9.&nbsp;Error Handler </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch08s05.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Part&nbsp;III.&nbsp;Reference Guide </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch09s02.html">Next</a> </td> </tr> </table> </div><br /> <br /> </td> </tr> </table> <div class="chapter" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="title"> <a name="reference.errorhandler" id= "reference.errorhandler"></a>Chapter&nbsp;9.&nbsp;Error Handler </h2> </div> <div class="toc"> <p class="c1"> Table of Contents </p> <dl> <dt> <span class="sect1"><a href= "ch09.html#id4794625">Introduction</a></span> </dt> <dt> <span class="sect1"><a href="ch09s02.html">Configuring a Handler</a></span> </dt> <dt> <span class="sect1"><a href="ch09s03.html">Controlling error generation</a></span> </dt> <dt> <span class="sect1"><a href="ch09s04.html">Error Context Display</a></span> </dt> <dt> <span class="sect1"><a href="ch09s05.html">Custom Error Message Generation</a></span> </dt> <dd> <dl> <dt> <span class="sect2"><a href="ch09s05.html#id4796665">Option: message_callback</a></span> </dt> <dt> <span class="sect2"><a href="ch09s05.html#id4796698">Option: context_callback</a></span> </dt> </dl> </dd> </dl> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="title c2"> <a name="id4794625" id="id4794625"></a>Introduction </h2> </div> <p> The HTML_CSS package is implemented with a flexible error handler plug-in system. You may use any error handler that you want. Using <code class="classname">PEAR_Error</code> object (default), but also the <code class="classname">PEAR_ErrorStack</code> package, or any other error handler you might want to plug in. </p> <p> Without any configuration, each HTML_CSS API error (basic or exception) will raise a <code class="classname">HTML_CSS_Error</code> object that will be return to call script (user script). </p> <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"> Easy to distinct basic PEAR_Error from other PEAR packages to HTML_CSS errors, even if there is a better and more robust solution: <code class="methodname">HTML_CSS::isError()</code>. But also provide a unique way to retrieve the level of error (warning, error, exception) with the <code class= "methodname">HTML_CSS_Error::getLevel()</code> method. </td> </tr> </table> </div> <p> As usual you can use the PEAR error API as well. </p> <div class="php c4"> <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"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$result</span> = <span class= "re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'div'</span>, <span class="st0">'color'</span>, <span class="nu0">5</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">if</span> <span class= "br0">(</span>PEAR::<span class= "me2">isError</span><span class="br0">(</span><span class= "re0">$result</span><span class="br0">)</span><span class= "br0">)</span> <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="co1">// do something when an error is raised</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> <p> and output to screen will give something like : </p> <div class="informalexample screenco"> <pre class="screen"> Exception<a name="error.1.level" id="error.1.level"></a><img src= "img/callouts/1.gif" alt="1" border= "0" />: invalid input, parameter #3 "$value" was expecting "string", instead got "integer"<a name="error.1.message" id= "error.1.message"></a><img src="img/callouts/2.gif" alt="2" border= "0" /> in html_css-&gt;setstyle (file [path_to]\[filename] on line 6)<a name= "error.1.context" id="error.1.context"></a><img src="img/callouts/3.gif" alt= "3" border="0" /> </pre> <div class="calloutlist"> <table border="0" summary="Callout list"> <tr> <td width="5%" valign="top" align="left"> <a href="#error.1.level"><img src="img/callouts/1.gif" alt= "1" border="0" /></a> </td> <td valign="top" align="left"> <p> error level </p> </td> </tr> <tr> <td width="5%" valign="top" align="left"> <a href="#error.1.message"><img src="img/callouts/2.gif" alt= "2" border="0" /></a> </td> <td valign="top" align="left"> <p> message body with context informations </p> </td> </tr> <tr> <td width="5%" valign="top" align="left"> <a href="#error.1.context"><img src="img/callouts/3.gif" alt= "3" border="0" /></a> </td> <td valign="top" align="left"> <p> call context </p> </td> </tr> </table> </div> </div> <p> Perhaps this standard behavior is not what you want. Don't worry, you can change everything : </p> <div class="itemizedlist"> <ul type="disc"> <li>display or ignore the error </li> <li>display or hide part of message (error level, body, context) </li> </ul> </div> <div class="important c3"> <table border="0" summary="Important"> <tr> <td rowspan="2" align="center" valign="top" width="48"> <img alt="[Important]" src="img/admons/important.png" /> </td> <th align="left"> Important </th> </tr> <tr> <td align="left" valign="top"> HTML_CSS obey at <a class="external" href= "http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors" title= "http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors"> display_errors</a> and <a class="external" href= "http://www.php.net/manual/en/ref.errorfunc.php#ini.log-errors" title= "http://www.php.net/manual/en/ref.errorfunc.php#ini.log-errors"> log_errors</a> protocol </td> </tr> </table> </div> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch08s05.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="pt03.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch09s02.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Searching for selectors and/or properties&nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Configuring a Handler </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch09s02.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch09s02.html +++ pear/HTML_CSS/docs/TDG/ch09s02.html <?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> Configuring a Handler </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="ch09.html" title= "Chapter&nbsp;9.&nbsp;Error Handler" /> <link rel="prev" href="ch09.html" title= "Chapter&nbsp;9.&nbsp;Error Handler" /> <link rel="next" href="ch09s03.html" title= "Controlling error generation " /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } p.c3 {font-weight: bold} 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"> Configuring a Handler </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch09.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Chapter&nbsp;9.&nbsp;Error Handler </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch09s03.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="id4795441" id="id4795441"></a>Configuring a Handler </h2> </div> <p> A error handler's configuration is determined by the arguments used in its construction. Here's an overview of these parameters. </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">$errorConf</span> = <span class= "kw3">array</span><span class="br0">(</span><span class= "st0">'error_handler'</span> =&gt; <span class= "st0">'myErrorHandler'</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">'push_callback'</span> =&gt; <span class= "st0">'myError'</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">// ... more options</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">)</span>; </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="kw2">null</span>, <span class="re0">$errorConf</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> <div class="table"> <a name="id4795464" id="id4795464"></a> <p class="title c3"> Table&nbsp;9.1.&nbsp;Error Handler configuration parameters </p> <table summary="Error Handler configuration parameters" border="1"> <colgroup> <col /> <col /> <col /> </colgroup> <thead> <tr> <th> Option </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> error_handler </td> <td> callback </td> <td> A valid callback (function) to manage errors raised by the <code class="methodname">HTML_CSS::raiseError()</code> method. Default is: <code class= "methodname">HTML_CSS::_errorHandler</code> </td> </tr> <tr> <td> push_callback </td> <td> callback </td> <td> A valid callback (function) that decides to following action. Default return: <code class="constant">PEAR_ERROR_DIE</code> if exception, <code class="constant">NULL</code> otherwise. </td> </tr> <tr> <td> message_callback </td> <td> callback </td> <td> A valid callback (function) to control message generation. Default is: <code class= "methodname">HTML_CSS_Error::_msgCallback</code> </td> </tr> <tr> <td> context_callback </td> <td> callback </td> <td> A valid callback (function) to control error context generation. Default is: <code class= "methodname">HTML_CSS_Error::getBacktrace</code> </td> </tr> <tr> <td> handler </td> <td> mixed </td> <td> any handler-specific settings </td> </tr> </tbody> </table> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch09.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="ch09.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch09s03.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Chapter&nbsp;9.&nbsp;Error Handler&nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Controlling error generation </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch09s03.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch09s03.html +++ pear/HTML_CSS/docs/TDG/ch09s03.html <?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> Controlling error generation </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="ch09.html" title= "Chapter&nbsp;9.&nbsp;Error Handler" /> <link rel="prev" href="ch09s02.html" title="Configuring a Handler " /> <link rel="next" href="ch09s04.html" title="Error Context Display " /> <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"> Controlling error generation </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch09s02.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Chapter&nbsp;9.&nbsp;Error Handler </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch09s04.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="id4795614" id="id4795614"></a>Controlling error generation </h2> </div> <p> There are many scenarios in which fine-grained control over error raising is absolutely necessary. </p> <p> The first level to control error generation is the <code class= "filename">php.ini</code> directives <span class= "emphasis"><em>display_errors</em></span> and <span class= "emphasis"><em>log_errors</em></span>. When these directives are set to <code class="constant">TRUE</code>, then browser and file outputs are effective. </p> <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 you want to ignore all errors raised (no display, no logs) and avoid to include PEAR core class, then you should have something like : <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="kw2">function</span> myErrorHandler<span class="br0">(</span><span class= "br0">)</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">null</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$errorConf</span> = <span class= "kw3">array</span><span class="br0">(</span><span class= "st0">'error_handler'</span> =&gt; <span class= "st0">'myErrorHandler'</span><span class="br0">)</span>; </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="kw2">null</span>, <span class= "re0">$errorConf</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// ...</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> </td> </tr> </table> </div> <p> With <span class="bold"><strong>push_callback</strong></span> option, you can decides to stop script execution (as done with exceptions by default: returns <code class="constant">PEAR_ERROR_DIE</code> constant), or continue without filtering (returns <code class= "constant">NULL</code>). </p> <p> If you want to write your own callback function for the <span class= "emphasis"><em>push_callback</em></span> option, this one should have two arguments: first one will get the error code, and second will get error level. These are all the necessary informations to do a filtering. Example that follow show how to be aware that a script use wrong argument data type. </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="kw2">function</span> myErrorFilter<span class= "br0">(</span><span class="re0">$code</span>, <span class= "re0">$level</span><span class="br0">)</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="kw1">if</span> <span class= "br0">(</span><span class="re0">$code</span> === HTML_CSS_ERROR_INVALID_INPUT<span class="br0">)</span> <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; <span class= "kw3">error_log</span><span class="br0">(</span><span class= "st0">'script: '</span>.<span class= "kw2">__FILE__</span>.<span class="st0">' used wrong argument data type'</span>, <span class="nu0">1</span>, <span class= "st0">'admin@yoursite.com'</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="kw1">return</span> <span class= "kw2">null</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$errorConf</span> = <span class= "kw3">array</span><span class="br0">(</span><span class= "st0">'push_callback'</span> =&gt; <span class= "st0">'myErrorFilter'</span><span class="br0">)</span>; </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="kw2">null</span>, <span class="re0">$errorConf</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// ...</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch09s02.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="ch09.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch09s04.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Configuring a Handler &nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Error Context Display </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch09s04.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch09s04.html +++ pear/HTML_CSS/docs/TDG/ch09s04.html <?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> Error Context Display </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="ch09.html" title= "Chapter&nbsp;9.&nbsp;Error Handler" /> <link rel="prev" href="ch09s03.html" title= "Controlling error generation " /> <link rel="next" href="ch09s05.html" title= "Custom Error Message Generation " /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } p.c4 {font-weight: bold} 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"> Error Context Display </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch09s03.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Chapter&nbsp;9.&nbsp;Error Handler </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch09s05.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="id4795725" id="id4795725"></a>Error Context Display </h2> </div> <p> In some cases, you may want to customize error generation. For instance, for each error (basic/exception), it is useful to include file, line number, and class/function context information in order to trace it. The default option will be sufficient for most cases but you want perhaps customize the output format (render) of context information. </p> <p> With this example we will change display and log renders. </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">$displayConfig</span> = <span class= "kw3">array</span><span class="br0">(</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">'lineFormat'</span> =&gt; <span class="st0">'&lt;b&gt;%1$s&lt;/b&gt;: %2$s&lt;br /&gt;%3$s'</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">'contextFormat'</span> =&gt;&nbsp; &nbsp;<span class="st0">'&lt;b&gt;File:&lt;/b&gt; %1$s &lt;br /&gt;'</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;. <span class="st0">'&lt;b&gt;Line:&lt;/b&gt; %2$s &lt;br /&gt;'</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;. <span class= "st0">'&lt;b&gt;Function:&lt;/b&gt; %3$s '</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$logConfig</span> = <span class= "kw3">array</span><span class="br0">(</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">'lineFormat'</span> =&gt; <span class="st0">'%1$s %2$s [%3$s] %4$s'</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">'timeFormat'</span> =&gt; <span class="st0">'%b'</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$prefs</span> = <span class= "kw3">array</span><span class="br0">(</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">'handler'</span> =&gt; <span class="kw3">array</span><span class= "br0">(</span><span class="st0">'display'</span> =&gt; <span class="re0">$displayConfig</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">'log'</span>&nbsp; &nbsp; &nbsp;=&gt; <span class="re0">$logConfig</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">)</span><span class="br0">)</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="kw2">null</span>, <span class="re0">$prefs</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// ...</span> </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$result</span> = <span class= "re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'div'</span>, <span class="st0">'color'</span>, <span class="nu0">5</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> <p> Display render will give something like: </p> <div class="informalexample screenco"> <pre class="screen"> Exception<a name="error.2.level" id="error.2.level"></a><img src= "img/callouts/1.gif" alt="1" border= "0" />: invalid input, parameter #3 "$value" was expecting "string", instead got "integer"<a name="error.2.message" id="error.2.message"></a><img src="img/callouts/2.gif" alt="2" border="0" /> File: [path_to]\[filename] <a name="error.2.context" id= "error.2.context"></a><img src="img/callouts/3.gif" alt="3" border="0" /> Line: 22 <a name="error.2.context" id="error.2.context"></a><img src= "img/callouts/3.gif" alt="3" border="0" /> Function: html_css-&gt;setstyle <a name="error.2.context" id= "error.2.context"></a><img src="img/callouts/3.gif" alt="3" border="0" /> </pre> <div class="calloutlist"> <table border="0" summary="Callout list"> <tr> <td width="5%" valign="top" align="left"> <a href="#error.2.level"><img src="img/callouts/1.gif" alt="1" border="0" /></a> </td> <td valign="top" align="left"> <p> error level </p> </td> </tr> <tr> <td width="5%" valign="top" align="left"> <a href="#error.2.message"><img src="img/callouts/2.gif" alt= "2" border="0" /></a> </td> <td valign="top" align="left"> <p> message body with context informations </p> </td> </tr> <tr> <td width="5%" valign="top" align="left"> <a href="#error.2.context"><img src="img/callouts/3.gif" alt= "3" border="0" /></a> </td> <td valign="top" align="left"> <p> call context (file, line, function) </p> </td> </tr> </table> </div> </div> <p> Log render will give something like: </p> <div class="informalexample screenco"> <pre class="screen"> Jun 127.0.0.1<a name="error.3.context" id="error.3.context"></a><img src= "img/callouts/1.gif" alt="1" border="0" /> [exception<a name="error.3.level" id="error.3.level"></a><img src="img/callouts/2.gif" alt="2" border= "0" />] invalid input, parameter #3 "$value" was expecting "string", instead got "integer"<a name="error.3.message" id="error.3.message"></a><img src="img/callouts/3.gif" alt="3" border="0" /> </pre> <div class="calloutlist"> <table border="0" summary="Callout list"> <tr> <td width="5%" valign="top" align="left"> <a href="#error.3.context"><img src="img/callouts/1.gif" alt= "1" border="0" /></a> </td> <td valign="top" align="left"> <p> client ip address and execution date </p> </td> </tr> <tr> <td width="5%" valign="top" align="left"> <a href="#error.3.level"><img src="img/callouts/2.gif" alt="2" border="0" /></a> </td> <td valign="top" align="left"> <p> error level </p> </td> </tr> <tr> <td width="5%" valign="top" align="left"> <a href="#error.3.message"><img src="img/callouts/3.gif" alt= "3" border="0" /></a> </td> <td valign="top" align="left"> <p> message body with context informations </p> </td> </tr> </table> </div> </div> <div class="note c3"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="48"> <img alt="[Note]" src="img/admons/note.png" /> </td> <th align="left"> Note </th> </tr> <tr> <td align="left" valign="top"> To have both display and log output, check the <code class= "filename">php.ini</code><span class= "emphasis"><em>display_errors</em></span> and <span class= "emphasis"><em>log_errors</em></span> values : must be set to <code class="constant">TRUE</code>. </td> </tr> </table> </div> <p> Let review, step by step, how to get such results. </p> <p> Remember that with default classes, there are two drivers : <span class="emphasis"><em>display</em></span> and <span class= "emphasis"><em>log</em></span> that have both their own configuration parameters. You can override these parameters values with the <span class="bold"><strong>handler</strong></span> entry in the hash of second argument of the HTML_CSS class constructor. </p> <p> We did it here with the <em class="parameter"><code>$prefs</code></em> variable; its a two keys associative array. First key <span class= "emphasis"><em>display</em></span> defines the display driver values, and the second key <span class="emphasis"><em>log</em></span> defines the log driver values. </p> <p> Review the <span class="emphasis"><em>display</em></span> driver custom values. Only two keys: <span class="simplelist">lineFormat, contextFormat</span> are redefined, thats means remains key <span class="simplelist">eol</span> keep its default value. See table below. </p> <div class="table"> <a name="id4796205" id="id4796205"></a> <p class="title c4"> Table&nbsp;9.2.&nbsp;Display driver configuration parameters </p> <table summary="Display driver configuration parameters" border="1"> <colgroup> <col /> <col /> <col /> <col /> </colgroup> <thead> <tr> <th> Parameter </th> <th> Type </th> <th> Default </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> eol </td> <td> string </td> <td> &lt;br /&gt;\n </td> <td> The end-on-line character sequence </td> </tr> <tr> <td> lineFormat </td> <td> string </td> <td> &lt;b&gt;%1$s&lt;/b&gt;: %2$s %3$s </td> <td> Log line format specification: <div class="itemizedlist"> <ul type="disc"> <li>1$ = error level </li> <li>2$ = error message (body) </li> <li>3$ = error context </li> </ul> </div> </td> </tr> <tr> <td> contextFormat </td> <td> string </td> <td> in &lt;b&gt;%3$s&lt;/b&gt; (file &lt;b&gt;%1$s&lt;/b&gt; on line &lt;b&gt;%2$s&lt;/b&gt;) </td> <td> Context format (class, file, line) specification: <div class="itemizedlist"> <ul type="disc"> <li>1$ = script file name </li> <li>2$ = line in script file </li> <li>3$ = class/method names </li> </ul> </div> </td> </tr> </tbody> </table> </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 you don't wish to see context information in the error message, then remove the parameter %3$ in the <span class= "emphasis"><em>lineFormat</em></span> option even if <span class= "emphasis"><em>contextFormat</em></span> is set. </td> </tr> </table> </div> <p> Review now the <span class="emphasis"><em>log</em></span> driver custom values. Only two keys <span class="simplelist">lineFormat, timeFormat</span> are redefined, thats means six remains keys <span class="simplelist">eol, contextFormat, ident, message_type, destination, extra_headers</span> keep their default values. See table below. </p> <div class="table"> <a name="id4796396" id="id4796396"></a> <p class="title c4"> Table&nbsp;9.3.&nbsp;Log driver configuration parameters </p> <table summary="Log driver configuration parameters" border="1"> <colgroup> <col /> <col /> <col /> <col /> </colgroup> <thead> <tr> <th> Parameter </th> <th> Type </th> <th> Default </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> eol </td> <td> string </td> <td> \n </td> <td> The end-on-line character sequence </td> </tr> <tr> <td> lineFormat </td> <td> string </td> <td> %1$s %2$s [%3$s] %4$s %5$s </td> <td> Log line format specification: <div class="itemizedlist"> <ul type="disc"> <li>$1 = time error </li> <li>2$ = ident (client ip) </li> <li>3$ = error level </li> <li>4$ = error message (body) </li> <li>5$ = error context </li> </ul> </div> </td> </tr> <tr> <td> contextFormat </td> <td> string </td> <td> in %3$s (file %1$s on line %2$s) </td> <td> Context format (class, file, line) specification: <div class="itemizedlist"> <ul type="disc"> <li>1$ = script file name </li> <li>2$ = line in script file </li> <li>3$ = class/method names </li> </ul> </div> </td> </tr> <tr> <td> timeFormat </td> <td> string </td> <td> %b %d %H:%M:%S </td> <td> Time stamp format used by <a class="external" href= "http://www.php.net/manual-lookup.php?pattern=strftime" title= "http://www.php.net/manual-lookup.php?pattern=strftime">strftime</a> </td> </tr> <tr> <td> ident </td> <td> string </td> <td> REMOTE_ADDR </td> <td> Client IP </td> </tr> <tr> <td> message_type </td> <td> string </td> <td> 3 </td> <td> Destination type used by <a class="external" href= "http://www.php.net/manual-lookup.php?pattern=error_log" title= "http://www.php.net/manual-lookup.php?pattern=error_log">error_log</a> </td> </tr> <tr> <td> destination </td> <td> string </td> <td> html_css_error.log </td> <td> Destination name used by <a class="external" href= "http://www.php.net/manual-lookup.php?pattern=error_log" title= "http://www.php.net/manual-lookup.php?pattern=error_log">error_log</a> </td> </tr> <tr> <td> extra_headers </td> <td> string </td> <td> <code class="constant">NULL</code> </td> <td> Extra headers depending of destination type </td> </tr> </tbody> </table> </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 you don't wish to see context information in the error message, then remove the parameter %5$ in the <span class= "emphasis"><em>lineFormat</em></span> option even if <span class= "emphasis"><em>contextFormat</em></span> is set. </td> </tr> </table> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch09s03.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="ch09.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch09s05.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Controlling error generation &nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Custom Error Message Generation </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch09s05.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch09s05.html +++ pear/HTML_CSS/docs/TDG/ch09s05.html <?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> Custom Error Message Generation </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="ch09.html" title= "Chapter&nbsp;9.&nbsp;Error Handler" /> <link rel="prev" href="ch09s04.html" title="Error Context Display " /> <link rel="next" href="pt04.html" title="Part&nbsp;IV.&nbsp;Appendixes" /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } 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"> Custom Error Message Generation </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch09s04.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Chapter&nbsp;9.&nbsp;Error Handler </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="pt04.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="id4796652" id="id4796652"></a>Custom Error Message Generation </h2> </div> <div class="toc"> <dl> <dt> <span class="sect2"><a href="ch09s05.html#id4796665">Option: message_callback</a></span> </dt> <dt> <span class="sect2"><a href="ch09s05.html#id4796698">Option: context_callback</a></span> </dt> </dl> </div> <p> There are two methods of <code class="classname">HTML_CSS_Error</code> designed for use with generating error messages efficiently. To use them, you must set the options below in the HTML_CSS class constructor (argument #2): </p> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h3 class="title"> <a name="id4796665" id="id4796665"></a>Option: message_callback </h3> </div> <p> The default message handling callback (<code class= "methodname">HTML_CSS_Error::_getErrorMessage</code>) get an array mapping error codes to error message templates, like so: </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="re0">$messages</span> = <span class= "kw3">array</span><span class="br0">(</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; HTML_CSS_ERROR_UNKNOWN =&gt; </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">'unknown error'</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; HTML_CSS_ERROR_INVALID_INPUT =&gt; </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">'invalid input, parameter #%paramnum% '</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; . <span class="st0">'"%var%" was expecting '</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; &nbsp; . <span class="st0">'"%expected%", instead got "%was%"'</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> <p> Basically, if a variable name is enclosed in percent signs (%), it will be replaced with the value passed in the associative array. </p> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h3 class="title"> <a name="id4796698" id="id4796698"></a>Option: context_callback </h3> </div> <p> The default context handling callback (<code class= "methodname">HTML_CSS_Error::getBackTrace</code>) gets an array of execution functions and discovers where the error was generated. </p> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch09s04.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="ch09.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="pt04.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Error Context Display &nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Part&nbsp;IV.&nbsp;Appendixes </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch10.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch10.html +++ pear/HTML_CSS/docs/TDG/ch10.html <?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> Chapter&nbsp;10.&nbsp;Examples </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="pt04.html" title="Part&nbsp;IV.&nbsp;Appendixes" /> <link rel="prev" href="pt04.html" title="Part&nbsp;IV.&nbsp;Appendixes" /> <link rel="next" href="ch10s02.html" title="Parsing data sources usage " /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } div.c3 {font-family: monospace;} h2.c2 {clear: both} p.c1 {font-weight: bold} /*]]>*/ </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"> Chapter&nbsp;10.&nbsp;Examples </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="pt04.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Part&nbsp;IV.&nbsp;Appendixes </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch10s02.html">Next</a> </td> </tr> </table> </div><br /> <br /> </td> </tr> </table> <div class="chapter" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="title"> <a name="examples" id="examples"></a>Chapter&nbsp;10.&nbsp;Examples </h2> </div> <div class="toc"> <p class="c1"> Table of Contents </p> <dl> <dt> <span class="sect1"><a href="ch10.html#examples.basic">Basic usage</a></span> </dt> <dd> <dl> <dt> <span class="sect2"><a href="ch10.html#examples.basic.1">Simple selectors with one or more property</a></span> </dt> <dt> <span class="sect2"><a href= "ch10.html#examples.basic.2">Combine selectors with one or more property</a></span> </dt> </dl> </dd> <dt> <span class="sect1"><a href="ch10s02.html">Parsing data sources usage</a></span> </dt> <dd> <dl> <dt> <span class="sect2"><a href= "ch10s02.html#examples.parse.1">Parse a string that contains CSS information</a></span> </dt> <dt> <span class="sect2"><a href= "ch10s02.html#examples.parse.2">Parse multiple data sources at once</a></span> </dt> </dl> </dd> </dl> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="title c2"> <a name="examples.basic" id="examples.basic"></a>Basic usage </h2> </div> <div class="toc"> <dl> <dt> <span class="sect2"><a href="ch10.html#examples.basic.1">Simple selectors with one or more property</a></span> </dt> <dt> <span class="sect2"><a href="ch10.html#examples.basic.2">Combine selectors with one or more property</a></span> </dt> </dl> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h3 class="title"> <a name="examples.basic.1" id="examples.basic.1"></a>Simple selectors with one or more property </h3> </div> <p> This example give you ability to define some styles from scratch and produce a simple style sheet output directly to browser. </p> <p> Here is the result we should expected : </p> <div class="css c3"> <ol> <li class="li1"> <div class="de1"> body <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">background-color</span>: #0c0c0c; </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">color</span>: #ffffff; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> h1 <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">text-align</span>: <span class= "kw2">center</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">font</span>: 16pt helvetica, arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> p <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">font</span>: 12pt helvetica, arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> </ol> </div> <div class="example"> <a name="id4797953" id="id4797953"></a> <p class="title c1"> Example&nbsp;10.1.&nbsp;Simple selector definitions </p> <div class="php c3"> <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"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// define styles</span> </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'body'</span>, <span class= "st0">'background-color'</span>, <span class= "st0">'#0c0c0c'</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'body'</span>, <span class="st0">'color'</span>, <span class="st0">'#ffffff'</span><span class= "br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'h1'</span>, <span class="st0">'text-align'</span>, <span class="st0">'center'</span><span class= "br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'h1'</span>, <span class="st0">'font'</span>, <span class="st0">'16pt helvetica, arial, sans-serif'</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'p'</span>, <span class="st0">'font'</span>, <span class="st0">'12pt helvetica, arial, sans-serif'</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// output the stylesheet directly to browser</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> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h3 class="title"> <a name="examples.basic.2" id="examples.basic.2"></a>Combine selectors with one or more property </h3> </div> <p> This example give you ability to define another selector with same properties as the previous one already defined. The simple style sheet is output directly to browser. </p> <p> Here <code class="literal">p</code> and <code class= "literal">div#black</code> selectors share the same properties. </p> <p> Here is the result we should expected : </p> <div class="css c3"> <ol> <li class="li1"> <div class="de1"> p, div<span class="re0">#black <span class= "br0">{</span></span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">font</span>: 12pt helvetica, arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> </ol> </div> <div class="example"> <a name="id4798032" id="id4798032"></a> <p class="title c1"> Example&nbsp;10.2.&nbsp;Combine selectors properties </p> <div class="php c3"> <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"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// define styles</span> </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setStyle</span><span class="br0">(</span><span class= "st0">'p'</span>, <span class="st0">'font'</span>, <span class="st0">'12pt helvetica, arial, sans-serif'</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="re0">$css</span>-&gt;<span class= "me1">setSameStyle</span><span class= "br0">(</span><span class="st0">'div#black'</span>, <span class="st0">'p'</span><span class="br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="co1">// output the stylesheet directly to browser</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> </div> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="pt04.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="pt04.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch10s02.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Part&nbsp;IV.&nbsp;Appendixes&nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Parsing data sources usage </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/ch10s02.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/ch10s02.html +++ pear/HTML_CSS/docs/TDG/ch10s02.html <?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> Parsing data sources usage </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="ch10.html" title="Chapter&nbsp;10.&nbsp;Examples" /> <link rel="prev" href="ch10.html" title="Chapter&nbsp;10.&nbsp;Examples" /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } p.c3 {font-weight: bold} 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"> Parsing data sources usage </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch10.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Chapter&nbsp;10.&nbsp;Examples </th> <td width="20%" align="right"> &nbsp; </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="examples.parse" id="examples.parse"></a>Parsing data sources usage </h2> </div> <div class="toc"> <dl> <dt> <span class="sect2"><a href="ch10s02.html#examples.parse.1">Parse a string that contains CSS information</a></span> </dt> <dt> <span class="sect2"><a href="ch10s02.html#examples.parse.2">Parse multiple data sources at once</a></span> </dt> </dl> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h3 class="title"> <a name="examples.parse.1" id="examples.parse.1"></a>Parse a string that contains CSS information </h3> </div> <p> In this example, here are our goal : </p> <div class="itemizedlist"> <ul type="disc"> <li>load CSS definitions from a simple PHP string </li> </ul> </div> <div class="css c2"> <ol> <li class="li1"> <div class="de1"> *<span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">margin</span>: 0px; <span class= "kw1">padding</span>: 0px; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> body<span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">font-family</span>: Lucida Grande, Tahoma, Verdana, Arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">text-align</span>:<span class= "kw2">center</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">background-color</span>:#fff; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> </ol> </div> <div class="example"> <a name="id4798718" id="id4798718"></a> <p class="title c3"> Example&nbsp;10.3.&nbsp;Simple string parsing </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">$styles</span> = <span class="st0">'</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">*{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">margin: 0px; padding: 0px;</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> <span class="st0">body{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">font-family: Lucida Grande, Tahoma, Verdana, Arial, sans-serif;</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">text-align:center;</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">background-color:#fff;</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">}</span> </div> </li> <li class="li1"> <div class="de1"> <span class="st0">'</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">parseString</span><span class= "br0">(</span><span class="re0">$styles</span><span class= "br0">)</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw2">?&gt;</span> </div> </li> </ol> </div> </div> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h3 class="title"> <a name="examples.parse.2" id="examples.parse.2"></a>Parse multiple data sources at once </h3> </div> <p> In this example, here are our goals : </p> <div class="itemizedlist"> <ul type="disc"> <li>load CSS definitions from a simple PHP string </li> <li>load CSS definitions from multiple CSS files </li> </ul> </div> <p> Here is content of <code class="filename">print.css</code> file : </p> <div class="css c2"> <ol> <li class="li1"> <div class="de1"> *<span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">margin</span>: 4px; <span class= "kw1">padding</span>: 0px; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> body<span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">font-family</span>: Tahoma, Verdana, Helvetica, Arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">text-align</span>:<span class= "kw2">center</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">background-color</span>:#fff; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> </ol> </div> <p> Here is content of <code class="filename">default.css</code> file : </p> <div class="css c2"> <ol> <li class="li1"> <div class="de1"> *<span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">margin</span>: 0px; <span class= "kw1">padding</span>: 0px; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> body<span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">font-family</span>: Lucida Grande, Tahoma, Verdana, Arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">text-align</span>:<span class= "kw2">center</span>; </div> </li> <li class="li1"> <div class="de1"> <span class="kw1">background-color</span>:#fff; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> </ol> </div> <div class="example"> <a name="id4799072" id="id4799072"></a> <p class="title c3"> Example&nbsp;10.4.&nbsp;Multiple data sources parsing </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">$styles</span> = <span class= "kw3">array</span><span class="br0">(</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">"body { font-size: 1em; }"</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">"print.css"</span>, </div> </li> <li class="li1"> <div class="de1"> &nbsp; &nbsp; <span class="st0">"default.css"</span> </div> </li> <li class="li1"> <div class="de1"> <span class="br0">)</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">parseData</span><span class="br0">(</span><span class= "re0">$styles</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> <p> And here are the result we should expected : </p> <div class="css c2"> <ol> <li class="li1"> <div class="de1"> body <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">font-size</span>: 1em; </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">font-family</span>: Lucida Grande, Tahoma, Verdana, Arial, <span class="kw2">sans-serif</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">text-align</span>: <span class= "kw2">center</span>; </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">background-color</span>: #fff; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; </div> </li> <li class="li1"> <div class="de1"> * <span class="br0">{</span> </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">margin</span>: 0px; </div> </li> <li class="li1"> <div class="de1"> &nbsp; <span class="kw1">padding</span>: 0px; </div> </li> <li class="li1"> <div class="de1"> <span class="br0">}</span> </div> </li> </ol> </div> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch10.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="ch10.html">Up</a> </td> <td width="40%" align="right"> &nbsp; </td> </tr> <tr> <td width="40%" align="left" valign="top"> Chapter&nbsp;10.&nbsp;Examples&nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp; </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/pt04.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/pt04.html +++ pear/HTML_CSS/docs/TDG/pt04.html <?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> Part&nbsp;IV.&nbsp;Appendixes </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="index.html" title="HTML_CSS Manual" /> <link rel="prev" href="ch09s05.html" title= "Custom Error Message Generation " /> <link rel="next" href="ch10.html" title="Chapter&nbsp;10.&nbsp;Examples" /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } p.c1 {font-weight: bold} /*]]>*/ </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"> Part&nbsp;IV.&nbsp;Appendixes </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch09s05.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> &nbsp; </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch10.html">Next</a> </td> </tr> </table> </div><br /> <br /> </td> </tr> </table> <div class="part" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="title"> <a name="appendix" id="appendix"></a>Part&nbsp;IV.&nbsp;Appendixes </h1> </div> <div class="toc"> <p class="c1"> Table of Contents </p> <dl> <dt> <span class="chapter"><a href="ch10.html">10. Examples</a></span> </dt> <dd> <dl> <dt> <span class="sect1"><a href="ch10.html#examples.basic">Basic usage</a></span> </dt> <dt> <span class="sect1"><a href="ch10s02.html">Parsing data sources usage</a></span> </dt> </dl> </dd> </dl> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch09s05.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> &nbsp; </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch10.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Custom Error Message Generation &nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Chapter&nbsp;10.&nbsp;Examples </td> </tr> </table> </div> </body> </html> http://cvs.php.net/viewvc.cgi/pear/HTML_CSS/docs/TDG/re24.html?view=markup&rev=1.1 Index: pear/HTML_CSS/docs/TDG/re24.html +++ pear/HTML_CSS/docs/TDG/re24.html <?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> HTML_CSS::grepStyle </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="ch08s05.html" title= "Searching for selectors and/or properties" /> <link rel="prev" href="ch08s05.html" title= "Searching for selectors and/or properties" /> <link rel="next" href="ch09.html" title= "Chapter&nbsp;9.&nbsp;Error Handler" /> <style type="text/css"> /*<![CDATA[*/ body { background-color: white; color: black; } :link { color: #0000FF } :visited { color: #840084 } :active { color: #0000FF } table.c1 {padding-bottom: 1em} /*]]>*/ </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"> <code class="function">HTML_CSS::grepStyle</code> </th> </tr> <tr> <td width="20%" align="left"> <a accesskey="p" href="ch08s05.html">Prev</a>&nbsp; </td> <th width="60%" align="center"> Searching for selectors and/or properties </th> <td width="20%" align="right"> &nbsp;<a accesskey="n" href="ch09.html">Next</a> </td> </tr> </table> </div><br /> <br /> </td> </tr> </table> <div class="refentry" lang="en" xml:lang="en"> <a name="package.html.html-css.html-css.grepstyle" id= "package.html.html-css.html-css.grepstyle"></a> <div class="titlepage"></div> <div class="refnamediv"> <h2> Name </h2> <p> <code class="function">HTML_CSS::grepStyle</code> - Return array entries of styles that match patterns (Perl compatible) </p> </div> <div class="refsynopsisdiv"> <h2> Synopsis </h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo"> require_once 'HTML/CSS.php'; </pre> <table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="c1"> <tr> <td> <code class="funcdef">array|PEAR_Error <b class= "fsfunc">HTML_CSS::grepStyle</b>(</code> </td> <td> <var class="pdparam">$elmPattern</var>, </td> <td> </td> </tr> <tr> <td> </td> <td> <var class="pdparam">$proPattern</var><code>)</code>; </td> <td> </td> </tr> </table> <table border="0" summary="Function argument synopsis" cellspacing= "0" cellpadding="0"> <tr> <td> string </td> <td> <var class="pdparam">$elmPattern</var>; </td> </tr> <tr> <td> string </td> <td> <var class="pdparam">$proPattern</var>; </td> </tr> </table> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a name="package.html.html-css.html-css.grepStyle.desc" id= "package.html.html-css.html-css.grepStyle.desc"></a> <h2> Description </h2> <p> This package is not documented yet. </p> </div> <div class="refsect1" lang="en" xml:lang="en"> <a name="package.html.html-css.html-css.grepStyle.param" id= "package.html.html-css.html-css.grepStyle.param"></a> <h2> Parameter </h2> <div class="variablelist"> <dl> <dt> <span class="term"><span class="type">string</span> <em class= "parameter"><code>$elmPattern</code></em></span> </dt> <dd> <p> Element or class pattern to retrieve </p> </dd> </dl> </div> <div class="variablelist"> <dl> <dt> <span class="term"><span class="type">string</span> <em class= "parameter"><code>$proPattern</code></em></span> </dt> <dd> <p> (optional) Property pattern to retrieve </p> </dd> </dl> </div> </div> <div class="refsect1" lang="en" xml:lang="en"> <a name="package.html.html-css.html-css.grepStyle.see" id= "package.html.html-css.html-css.grepStyle.see"></a> <h2> See </h2> <p> <span class="emphasis"><em>see</em></span> <a class="external" href= "http://www.php.net/manual/en/ref.pcre.php" title= "http://www.php.net/manual/en/ref.pcre.php">Regular Expression Functions (Perl-Compatible)</a> </p> </div> <div class="refsect1" lang="en" xml:lang="en"> <a name="package.html.html-css.html-css.grepStyle.throws" id= "package.html.html-css.html-css.grepStyle.throws"></a> <h2> Throws </h2> <p> <span class="emphasis"><em>throws</em></span> HTML_CSS_ERROR_INVALID_INPUT </p> </div> <div class="refsect1" lang="en" xml:lang="en"> <a name="package.html.html-css.html-css.grepStyle.note" id= "package.html.html-css.html-css.grepStyle.note"></a> <h2> Note </h2> <p> <span class="emphasis"><em>since</em></span> 1.1.0 </p> <p> This function can not be called statically. </p> </div> </div> <table class="htmlcssFooter"> <tr> <td align="left"> HTML_CSS : The Definitive Guide </td> <td align="right"> v 1.1.0 : January 1, 2007 </td> </tr> </table> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"> <a accesskey="p" href="ch08s05.html">Prev</a>&nbsp; </td> <td width="20%" align="center"> <a accesskey="u" href="ch08s05.html">Up</a> </td> <td width="40%" align="right"> &nbsp;<a accesskey="n" href="ch09.html">Next</a> </td> </tr> <tr> <td width="40%" align="left" valign="top"> Searching for selectors and/or properties&nbsp; </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> &nbsp;Chapter&nbsp;9.&nbsp;Error Handler </td> </tr> </table> </div> </body> </html>
« previous php.pear.cvs (#43893) next »