Login   Register  
PHP Classes
elePHPant
Icontem

File: msgbox_doc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Vedanta Barooah  >  Message Box  >  msgbox_doc.php  >  Download  
File: msgbox_doc.php
Role: Documentation
Content type: text/plain
Description: Documentation
Class: Message Box
Generate Windows style message boxes in HTML
Author: By
Last change:
Date: 2004-09-23 04:20
Size: 7,583 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Using the msgBox Class</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="msgbox_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
	body,td{
		font-family:Verdana, Arial, Helvetica, sans-serif;
		font-size:x-small;
	}
	.code{
	font-family:"Courier New", Courier, mono;
	font-size:x-small;
	background-color:#CCCCCC;
	}
</style>
</head>
<body>
<h3><u><strong>Using the msgBox Class to create Message Boxes <br>
  </strong></u></h3>
msgBox by Vedanta Barooah 

 
&lt; <a href="mailto:vedanta.barooah-at-gmail-dot-com">vedanta.barooah at gmail dot com </a>&gt;<div align="center">
<br>
<?
include("msgbox.inc.php");
$a=new msgBox("This is just a Message ","OKCancel","Jack Said!" ); 
// define the links
$links=array("ok.php","cancel.php"); 
// make the links
$a->makeLinks($links);
// draw the message box 
$a->showMsg(); 
?>
</div>
<br><br>
<table width="100%"  border="0" cellpadding="4" cellspacing="0" style="border:solid thin #666666 ">
  <tr>
    <td width="41%">Add the style sheet to the page </td>
    <td width="59%" class="code">&lt;link href=&quot;msgbox_style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;</td>
  </tr>
  <tr>
    <td width="41%">First you need to include the main class file.</td>
    <td width="59%" class="code">include(&quot;msgbox.inc.php&quot;);</td>
  </tr>
  <tr>
    <td>Create the instance of the class </td>
    <td class="code">$a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>OKCancel</strong>&quot;,&quot;Jack Said!&quot; );</td>
  </tr>
  <tr>
    <td>The constructor takes three parameters:<strong> <br>
      The message to be displayed</strong>,<br>
      <strong>The buttons in the message box</strong> and <strong><br>
      The title of the message box</strong>. </td>
    <td class="code">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top">Following are the valid arguments for the 2nd parameter:<br>
        <strong>OKOnly</strong>: Displays only the OK Button<strong><br>
      OKCancel</strong>: Displays OK and Cancel Button<br>
      <strong>AbortRetryIgnore</strong>: Abort, Retry and Cancel<br>
      <strong>YesNoCancel</strong><strong>: </strong>Yes, No, Cancel<br>
      <strong>YesNo</strong>: Yes and No <br>
      <strong>RetryCancel</strong>: Retry Cancel <br></td>
    <td valign="top" class="code"><p>// these are the valid args for the second param<br>
        # $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>OKOnly</strong>&quot;,&quot;Jack Said!&quot; ); <br>
        # $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>OKCancel</strong>&quot;,&quot;Jack Said!&quot; );<br>
        # $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>AbortRetryIgnore</strong>&quot;,&quot;Jack Said!&quot; ); <br>
        # $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>YesNoCancel</strong><strong></strong>&quot;,&quot;Jack Said!&quot; );<br>
        # $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>YesNo</strong>&quot;,&quot;Jack Said!&quot; );<br>
        # $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>RetryCancel</strong>&quot;,&quot;Jack Said!&quot; );</p></td>
  </tr>
  <tr>
    <td valign="top">The class need an array of links to create the buttons. For each button it requires a page to which it creates the link. </td>
    <td valign="top" class="code">// define the links<br>
      $links=array(&quot;abort.php&quot;,&quot;retry.php&quot;,&quot;ignore.php&quot;); <br>
      // make the links<br>
      $a-&gt;makeLinks($links); </td>
  </tr>
  <tr>
    <td valign="top">The final step draws the msgBox<br>
      Enjoy! </td>
    <td valign="top" class="code">// draw the message box <br>
      $a-&gt;showMsg();</td>
  </tr>
  <tr>
    <td valign="top"><strong>The Final Code </strong></td>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2" valign="top" class="code"><p>&lt;link href=&quot;msgbox_style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;<br>
        &lt;?php      <br>
        include(&quot;msgbox.inc.php&quot;);<br>
        $a=new msgBox(&quot;This is just a Message &quot;,&quot;<strong>OKCancel</strong>&quot;,&quot;Jack Said!&quot; ); <br>
        // define the links<br>
        $links=array(&quot;ok.php&quot;,&quot;cancel.php&quot;); <br>
        // make the links<br>
        $a-&gt;makeLinks($links);<br>
        // draw the message box <br>
      $a-&gt;showMsg(); <br>
      ?&gt;
    </p>      </td>
  </tr>
  <tr>
  	<td colspan="2"><strong>Here are other samples!</strong></td>
  </tr>
  <tr>
    <td valign="top" class="code">      $b=new msgBox(&quot;An unnamed file was not found&quot;,&quot;OKOnly&quot;,&quot;Setup&quot;); <br>
      # use the makeLinks() for the buttons to work      <br>
$b-&gt;showMsg();       <br>	</td>
    <td valign="top">
	   <?
			$b=new msgBox("An unnamed file was not found","OKOnly","Setup"); 
			# use the makeLinks() for the buttons to work
			$b->showMsg(); 
		?>
		<br>
	</td>
  </tr>
  <tr>
    <td valign="top" class="code">$b=new msgBox(&quot;You need to spend more money on me before I'm going to do anything consistantly.&quot;,&quot;OKCancel&quot;); <br>
# use the makeLinks() for the buttons to work<br>
$b-&gt;showMsg(); </td>
    <td valign="top">
	 <?
			$b=new msgBox("You need to spend more money on me before I'm going to do anything consistantly.","OKCancel"); 
			# use the makeLinks() for the buttons to work
			$b->showMsg(); 
	?>
	<br>
	</td>
  </tr>
  <tr>
    <td valign="top" class="code">$b=new msgBox(&quot;Bad Command or File Name&quot;,&quot;AbortRetryIgnore&quot;); <br>
# use the makeLinks() for the buttons to work<br>
$b-&gt;showMsg(); </td>
    <td valign="top">
	 <?
			$b=new msgBox("Bad Command or File Name","AbortRetryIgnore"); 
			# use the makeLinks() for the buttons to work
			$b->showMsg(); 
	?>
	</td>
  </tr>
  <tr>
    <td valign="top" class="code"> 
$b=new msgBox(&quot;FATAL system error #911&quot;,&quot;YesNoCancel&quot;,&quot;Call Him!!!!!!&quot;); <br>
# use the makeLinks() for the buttons to work<br>
$b-&gt;showMsg(); <br>
</td>
    <td valign="top">
	<?
			$b=new msgBox("FATAL system error #911","YesNoCancel","Call Him!!!!!!"); 
			# use the makeLinks() for the buttons to work
			$b->showMsg(); 
	?>
	<br>
	</td>
  </tr>
  <tr>
    <td valign="top" class="code">$b=new msgBox(&quot;Do you love me?&quot;,&quot;YesNo&quot;,&quot;Love me Love me Not?&quot;); <br>
# use the makeLinks() for the buttons to work<br>
$b-&gt;showMsg();</td>
    <td valign="top">
	<?
			$b=new msgBox("Do you love me?","YesNo","Love me Love me Not?"); 
			# use the makeLinks() for the buttons to work
			$b->showMsg(); 
	?>
	<br>
	</td>
  </tr>
  <tr>
    <td valign="top" class="code">$b=new msgBox(&quot;Out of order!!&quot;,&quot;RetryCancel&quot;,&quot;Damn!&quot;); <br>
# use the makeLinks() for the buttons to work<br>
$b-&gt;showMsg(); </td>
    <td valign="top">
	<?
			$b=new msgBox("Out of order!!","RetryCancel","Damn!"); 
			# use the makeLinks() for the buttons to work
			$b->showMsg(); 
	?>
	<br>
	</td>
  </tr>
  <tr>
    <td valign="top">&nbsp;</td>
    <td valign="top">&nbsp;</td>
  </tr>
</table>
<p><u><strong></strong></u> </p>
</body>
</html>