Location: PHPKode > scripts > Whisper Table > whisper-table/table.php
<!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">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<?php
	include ("scripts/core/wsp_table.php");


	echo('<br/><div style="text-align:center;width:100%">Example Table #1, Tres Simple</div>');
	$tbl = new WhisperTable("one");
	$tbl->SetDebug(true);
	$tbl->TableStyle('background-color:#DDDDFF;color:navy;text-align:center;width:50%');
	$tbl->CellValue(1, 1, 'blah blah blah blah');
	$tbl->CellValue(1, 2, 'cell 1x2');
	$tbl->CellValue(2, 1, 'cell 2x1');
	$tbl->CellValue(2, 2, 'some more content');
	echo($tbl->GetStyles());
	echo($tbl->GetTheTable());

echo('<br/><br/>');


	echo('<br/><div style="text-align:center;width:60%">Example Table #2, with Row Highlighting</div>');
	$tbl2 = new WhisperTable('two'); 
	$tbl2->ShowHeaders(true, true); 
	$tbl2->SetDebug(true); 
	$tbl2->TableStyle('background-color:#CCCCCC;color:blue;width:60%'); 
	$tbl2->RowStyle(0, 'background-color:#777777;color:white'); 
	$tbl2->ColStyle(0, 'background-color:#777777;color:white'); 
	$tbl2->CellValue(0, 1, 'Hdr1'); 
	$tbl2->CellValue(0, 2, 'Hdr2'); 
	$tbl2->CellValue(0, 3, 'Hdr3'); 
	$tbl2->CellValue(0, 4, 'Hdr4'); 
	$tbl2->CellValue(0, 5, 'Hdr5');
	$tbl2->CellValue(1, 1, '1x1');
	$tbl2->CellValue(2, 2, '2x2');
	$tbl2->CellValue(3, 3, '3x3');
	$tbl2->CellValue(4, 4, '4x4');
	$tbl2->CellValue(5, 5, '5x5');
	$tbl2->TableAlign('left');        // note: has no effect unless table width is less than 100%
	$tbl2->SetRowHighlight();
	echo($tbl2->GetStyles()); 
	echo($tbl2->GetTheTable()); 

	echo('<br/><br/>');
	echo('<br/><div style="text-align:center;width:90%">Example Table #3, with Cell Highlighting</div>');
	$tbl3 = new WhisperTable('three'); 
	$tbl3->ShowHeaders(true, true); 
	$tbl3->SetCellHighlight();                                            // turns on cell dynamic highlighting 
	$tbl3->SetDebug(true); 
	$tbl3->TableStyle('background-color:#FFDD99;color:navy;width:90%'); 
	$tbl3->TableAlign('center'); 
	$tbl3->CellValue(0,0, '<img src="check3.gif" style="width:20px">');    // Can embed images in cells just like this 
	$tbl3->CellValue(0,1, 'Header1'); 
	$tbl3->CellValue(0,2, 'Header2'); 
	$tbl3->CellValue(0,3, 'Header3'); 
	$tbl3->CellValue(0,4, 'Header4'); 
	$tbl3->CellValue(0,5, 'Header5'); 
	$tbl3->RowStyle(0, 'background-color:#999999;color:white;font-family:Comic Sans MS;font-size:large'); 
	$tbl3->ColStyle(0, 'background-color:white;color:blue'); 

	for ($row = 1; $row <= 10; $row++)
	{
		for ($col = 1; $col <= 5; $col++)
		{
			$content = $row . ' x ' . $col;
			$tbl3->CellValue($row, $col, $content);
			
			if ($row == $col)
			{
				$tbl3->CellStyle($row, $col, 'border:1px green solid');
			}
		}
	}
	echo($tbl3->GetStyles());
	echo($tbl3->GetTheTable()); 

	
	echo('<br/><br/>');
	echo('<br/><div style="text-align:center;width:90%">Example Table #4: A Color Chart in Saturated Blue</div>');
	$tbl4 = new WhisperTable('four'); 
	$tbl4->SetDebug(true);
	$tbl4->ShowHeaders(false, false); 
	$tbl4->TableAlign('center'); 
	$tbl4->TableStyle('font-size:small');

	for ($row = 0; $row <= 15; $row++)
	{
		$tbl4->RowHeight($row+1, 44);
		for ($col = 0; $col <= 15; $col++)
		{
			$clr = '#' . strtoupper((string)dechex($row) . (string)dechex($row) . (string)dechex($col) . (string)dechex($col) . 'FF');
			$cnt = '<span style="color:white">' . $clr . '</span><br/><span style="color:black">' . $clr . '</span>';
			$tbl4->CellValue($row+1, $col+1, $cnt);
			$tbl4->CellStyle($row+1, $col+1, 'background-color:' . $clr); 			
		}
	}	
	echo($tbl4->GetStyles());
	echo($tbl4->GetTheTable()); 

	
	echo('<br/><br/><br/>');
	
	

?>
</body>
</html>
Return current item: Whisper Table