Location: PHPKode > scripts > message > message/messagebox.php
<?
/***************************************************************************/
/*								MESSAGE BOX CLASS						   */
/*																		   */
/*	DEVELOPER : Fryderyk Benigni										   */
/*	DATE :		21/10/2004												   */
/* 	CLASS NAME: MESSAGE													   */
/*	CLASS FILE: messagebox.php											   */
/*	OBJECTIVE:	This class let you create a single instance of a message   */
/*				box class and reuse it as much as you want. It is very     */
/*				functional and easy to use. You can change Title and cont- */
/*				tent of the message box true the method setData(). It is   */
/*				It is possible to put Text or even images and HTML inside  */
/*				the message Box. It is possible also to change Message Box */
/*				appearance true the method setAspect() passing the right   */
/*				parameters. Without calling this method it will use the    */
/*				standard configured appearance listed in the __Construct() */
/*				method. This class can be extended and give a lot more 	   */
/*				options.												   */
/*	LICENSE:	GPL (Generic Public License)							   */
/*	P.S:		Thnaks to anybody that will like to use this class!!!	   */
/*				For any problem write to me an e-mail at:				   */
/*				hide@address.com									   */
/***************************************************************************/

//Class initialization
class message
{
var $msgtitle;				//Title appearing in the message box
var $content;				//Content appearing in the message box title
var $tablewidth;			//Message box Width
var $tableheight;			//Message box Height
var $tableborder;			//Message box Border
var $cellpad;				//Message box cellpad
var $cellspace;				//Message box cellspace
var $bordercolor;			//Message box border color
var $align;					//Message box general align
var $td1align;				//Title Align
var $td1bgcolor;			//Title Back ground color
var $td2align;				//Content Align
var $td2bgcolor;			//Content Background color


//Constructor method with standard appearance attributes
function __Construct($msgtitle, $content)
	{
		$this->msgtitle = $msgtitle;			//Title of the Message Box passed during the creation of the instance
		$this->content = $content;				//Content of the Message Box passed during the creation of the instance
		$this->tablewidth = 400;
		$this->tableborder = 1;
		$this->cellpad = 0;
		$this->cellspace = 0;
		$this->bordecolor = "#9DACBF";
		$this->align = "center";
		$this->td1align = "center";
		$this->td1bgcolor ="#9DACBF";
		$this->td2align = "center";
		$this->td2bgcolor ="FFFFFF";
	}
//Constructor method end


//setAspect() method is responsable of the possible changings of appearance of the Message Box
//Parameters order: 
//					table mwidth
//					table height
//					table border
//					cell pad
//					cell space
//					border color
//					general align
//					title align
//					Title background color
//					Content align
//					Content back ground color
function setAspect($twidth, $theight, $tborder, $cpad, $cspace, $brdclr, $align, $td1alg, $td1clr, $td2alg, $td2clr)
	{
		$this->tablewidth = $twidth;
		$this->tableheight = $theight;
		$this->tableborder = $tborder;
		$this->cellpad = $cpad;
		$this->cellspace = $cspace;
		$this->bordecolor = $brdclr;
		$this->align = $align;
		$this->td1align = $td1alg;
		$this->td1bgcolor = $td1clr;
		$this->td2align = $td2alg;
		$this->td2bgcolor = $td2clr;
	}
//setAspect() end



//setData() Method is responsable of setting title and contente text or HTML
function setData($msgtitle, $content)
	{
		$this->msgtitle = $msgtitle;
		$this->content = $content;
	}
//setData end


//showData() Method is responsable of showing the final Message Box
function showData()
	{
			
	print("<table width=\"$this->tablewidth\" height = \"$this->tableheight\" border=\"$this->tableborder\" align=\"$this->align\" cellpadding=\"$this->cellpad\" cellspacing=\"$this->cellspace\" bordercolor=\"$this->bordecolor\">
 		   <tr>
		   <td bgcolor=\"$this->td1bgcolor\" height = \"10\" ><div align=\"$this->td1align\">$this->msgtitle</div></td>
		   </tr>
		   <tr>
    	   <td bgcolor=\"$this->td2bgcolor\"><div align=\"$this->td2align\">"
		 );
	
	print("$this->content");			//Content of Message Box
	
	print("</div></td>
  		   </tr>
		   </table>"
		  );
	}
//showData end

}
//Class Message end
?>
Return current item: message