Location: PHPKode > scripts > Message Handler > message-handler/doc/index.htm
<html>

<head>
<meta http-equiv="Content-Language" content="de-ch">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>class.message.php - Documentation</title>
</head>

<body>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td width="100%" bgcolor="#666666"><b><font face="Arial" color="#FFFFFF" size="3">Class
      &quot;message&quot;</font></b></td>
  </tr>
  <tr>
    <td width="100%">
      <ul>
        <li><font face="Arial" size="2">Author: Marco Voegeli, </font><a href="http://www.voegeli.li"><font face="Arial" size="2">www.voegeli.li</font></a></li>
        <li><font face="Arial" size="2">License: Freeware</font></li>
        <li><font face="Arial" size="2">Purpose of this script: The class &quot;message&quot;
          provides a simple and object oriented way to handle errors in php
          scripts. it handles also the way, the message is written to the client
          (output). The object can have one or N message types and lines. So it
          can also be used as a protocol. It is very easy to use, please check
          the following example.</font></li>
      </ul>
    </td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#666666"><b><font face="Arial" color="#FFFFFF" size="3">Methods</font></b></td>
  </tr>
  <tr>
    <td width="100%"><font face="Arial" size="2">Following, the methods of this
      class are explained:</font>
      <table border="0" width="100%" cellspacing="0" cellpadding="2">
        <tr>
          <td width="20%"><b><font face="Arial" size="1">Method</font></b></td>
          <td width="80%"><b><font face="Arial" size="1">Description</font></b></td>
        </tr>
        <tr>
          <td width="20%"><font face="Arial" size="1">message()</font></td>
          <td width="80%"><font face="Arial" size="1">Constructor (private): No
            parameters possible</font></td>
        </tr>
        <tr>
          <td width="20%"><font face="Arial" size="1">clear()</font></td>
          <td width="80%"><font face="Arial" size="1">Clears the message table (unset)</font></td>
        </tr>
        <tr>
          <td width="20%"><font face="Arial" size="1">add(type,text)</font></td>
          <td width="80%"><font face="Arial" size="1">Adds a new message to the
            table.</font>
            <p><font face="Arial" size="1">type:</font></p>
            <ul>
              <li><font face="Arial" size="1">&quot;I&quot;, Information</font></li>
              <li><font face="Arial" size="1">&quot;W&quot;, Warning</font></li>
              <li><font face="Arial" size="1">&quot;E&quot;, Error</font></li>
              <li><font face="Arial" size="1">&quot;S&quot;, Success</font></li>
              <li><font face="Arial" size="1">&quot;D&quot;, Stop</font></li>
            </ul>
            <p><font face="Arial" size="1">text:&nbsp;</font></p>
            <p><font face="Arial" size="1">Contains the message text you want to
            output</font></td>
        </tr>
        <tr>
          <td width="20%"><font face="Arial" size="1">write(header)</font></td>
          <td width="80%"><font face="Arial" size="1">Writes the message table
            to the client (output).</font>
            <p><font face="Arial" size="1">header:</font></p>
            <ul>
              <li><font face="Arial" size="1">&quot;&quot;, No header output</font></li>
              <li><font face="Arial" size="1">&quot;X&quot;, Header output:
                &quot;Number of Messages: X&quot;</font></li>
            </ul>
            <p><font face="Arial" size="1">Sample Output:</font></p>
            <p><img border="0" src="output.jpg" width="768" height="167"></td>
        </tr>
        <tr>
          <td width="20%"><font face="Arial" size="1">haserrors()</font></td>
          <td width="80%"><font face="Arial" size="1">Delivers true, if one or
            more error messages are in the table (else: false)</font></td>
        </tr>
        <tr>
          <td width="20%"><font face="Arial" size="1">haswarnings()</font></td>
          <td width="80%"><font face="Arial" size="1">Delivers true, if one or
            more warning messages are in the table (else: false)</font></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#666666"><b><font face="Arial" color="#FFFFFF" size="3">Class
      Configuration</font></b></td>
  </tr>
  <tr>
    <td width="100%"><font face="Arial" size="2">Modify the following constants
      in the class:</font>
      <ul>
        <li><font face="Arial" size="2">const_path: This is the path for the
          message-images.</font></li>
      </ul>
    </td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#666666"><b><font face="Arial" color="#FFFFFF" size="3">Example
      Usage</font></b></td>
  </tr>
  <tr>
    <td width="100%"><font face="Arial" size="2">Following you find an example
      of the usage of this class:</font>
      <p><font face="Courier New" size="2" color="#000080">&lt;?php<br>
      <br>
      include_once '../class.message.php';<br>
      <br>
      $msg = new message();</font></p>
      <p><font face="Courier New" size="2" color="#000080"><br>
      $msg->add("I","Info");&nbsp;<br>
      $msg->add("E","Error");<br>
      $msg->add("W","Warn");<br>
      $msg->add("S","Success");<br>
      $msg-&gt;add(&quot;D&quot;,&quot;Stop&quot;);</font></p>
      <p><font face="Courier New" size="2" color="#000080"><br>
      $msg->write("");&nbsp;<br>
      <br>
      ?></font></p>
      <p>&nbsp;</p>
    </td>
  </tr>
</table>

</body>

</html>
Return current item: Message Handler