<!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
< <a href="mailto:vedanta.barooah-at-gmail-dot-com">vedanta.barooah at gmail dot com </a>><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"><link href="msgbox_style.css" rel="stylesheet" type="text/css"></td>
</tr>
<tr>
<td width="41%">First you need to include the main class file.</td>
<td width="59%" class="code">include("msgbox.inc.php");</td>
</tr>
<tr>
<td>Create the instance of the class </td>
<td class="code">$a=new msgBox("This is just a Message ","<strong>OKCancel</strong>","Jack Said!" );</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"> </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("This is just a Message ","<strong>OKOnly</strong>","Jack Said!" ); <br>
# $a=new msgBox("This is just a Message ","<strong>OKCancel</strong>","Jack Said!" );<br>
# $a=new msgBox("This is just a Message ","<strong>AbortRetryIgnore</strong>","Jack Said!" ); <br>
# $a=new msgBox("This is just a Message ","<strong>YesNoCancel</strong><strong></strong>","Jack Said!" );<br>
# $a=new msgBox("This is just a Message ","<strong>YesNo</strong>","Jack Said!" );<br>
# $a=new msgBox("This is just a Message ","<strong>RetryCancel</strong>","Jack Said!" );</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("abort.php","retry.php","ignore.php"); <br>
// make the links<br>
$a->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->showMsg();</td>
</tr>
<tr>
<td valign="top"><strong>The Final Code </strong></td>
<td valign="top"> </td>
</tr>
<tr>
<td colspan="2" valign="top" class="code"><p><link href="msgbox_style.css" rel="stylesheet" type="text/css"><br>
<?php <br>
include("msgbox.inc.php");<br>
$a=new msgBox("This is just a Message ","<strong>OKCancel</strong>","Jack Said!" ); <br>
// define the links<br>
$links=array("ok.php","cancel.php"); <br>
// make the links<br>
$a->makeLinks($links);<br>
// draw the message box <br>
$a->showMsg(); <br>
?>
</p> </td>
</tr>
<tr>
<td colspan="2"><strong>Here are other samples!</strong></td>
</tr>
<tr>
<td valign="top" class="code"> $b=new msgBox("An unnamed file was not found","OKOnly","Setup"); <br>
# use the makeLinks() for the buttons to work <br>
$b->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("You need to spend more money on me before I'm going to do anything consistantly.","OKCancel"); <br>
# use the makeLinks() for the buttons to work<br>
$b->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("Bad Command or File Name","AbortRetryIgnore"); <br>
# use the makeLinks() for the buttons to work<br>
$b->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("FATAL system error #911","YesNoCancel","Call Him!!!!!!"); <br>
# use the makeLinks() for the buttons to work<br>
$b->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("Do you love me?","YesNo","Love me Love me Not?"); <br>
# use the makeLinks() for the buttons to work<br>
$b->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("Out of order!!","RetryCancel","Damn!"); <br>
# use the makeLinks() for the buttons to work<br>
$b->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"> </td>
<td valign="top"> </td>
</tr>
</table>
<p><u><strong></strong></u> </p>
</body>
</html>
|