| 
<?php
 
 require_once "class.tableelement.php";
 
 
 // Example 1
 
 $Table = new TableElement("table_id");
 
 $Table->setStyle("width", "200px");
 
 // First row (note that colspan is calculated automatically, because the cell 0 x 1 is not defined)
 $Table->setCell(0, 0, "Table header");
 
 // Second row
 $Table->setCell(1, 0, "A");
 $Table->setCell(1, 1, "B");
 
 // Third row
 $Table->setCell(2, 0, "C");
 $Table->setCell(2, 1, "D");
 
 $Table->setCell(3, 0, "E");
 $Table->setCell(3, 1, "F");
 
 $Table->setCell(4, 0, "G");
 $Table->setCell(4, 1, "H");
 
 $Table->create();
 
 
 
 
 
 // Example 2
 
 $Table = new TableElement("table_id");
 
 $Table->highlightHeader(false);
 $Table->highlightFooter(true);
 
 // this will NOT alternate the background color of the rows
 $Table->altBgColor("");
 
 
 $Table->setStyle("margin-top", "50px");
 
 
 $Table->setCell(0, 0, "This table rows do NOT have alternated background colors");
 
 $Table->setCell(1, 0, "click in this cell!");
 $Table->setCellEvent(1, 0, "onclick", "alert('Hi, this is an event fired onclick!');");
 $Table->setCellStyle(1, 0, "border", "2px dotted red");
 
 $Table->setCell(1, 1, "You can define style properties to any tag");
 $Table->setCellStyle(1, 1, "color", "#0000cc");
 
 $Table->setCell(2, 0, "This table has "highlight footer" property on");
 
 $Table->setCell(3, 0, "And "highlight header" off");
 
 $Table->create();
 
 
 
 
 // Example 3
 
 $Table = new TableElement("table_id");
 
 $Table->highlightHeader(true);
 $Table->highlightFooter(true);
 
 // this will NOT alternate the background color of the rows
 $Table->altBgColor("#eef");
 
 
 $Table->setStyle("margin-top", "50px");
 
 
 $Table->setCell(0, 0, "A table with highlight header and footer on");
 
 $Table->setCell(1, 0, "A");
 $Table->setCell(1, 1, "B");
 
 $Table->setCell(2, 0, "C");
 $Table->setCell(2, 1, "D");
 
 $Table->setCell(3, 0, "E");
 
 $Table->setCell(4, 0, "F");
 $Table->setCell(4, 1, "G");
 
 $Table->setCell(5, 0, "The span is calculated automatically if there are blank cells");
 
 
 $Table->create();
 
 
 
 
 
 
 
 // Example 4
 
 $Table = new TableElement("table_id");
 
 $Table->highlightHeader(true);
 $Table->highlightFooter(true);
 
 // this will NOT alternate the background color of the rows
 $Table->altBgColor("#eef");
 
 
 $Table->setStyle("margin-top", "50px");
 
 
 $Table->setCell(0, 0, "But you can set the blank cell to be a row span from the cell above");
 
 $Table->setCell(1, 0, "A");
 $Table->setCell(1, 1, "B");
 
 $Table->setCell(2, 0, "C");
 $Table->setCell(2, 1, "D");
 
 $Table->setCell(3, 0, "E");
 
 $Table->setCell(4, 0, "F");
 $Table->setCell(4, 1, "G");
 
 
 
 $Table->row[2]->col[1]->setRowSpan(2);
 
 
 $Table->create();
 
 
 
 
 
 
 ?>
 |