Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Carlos Reche  >  Table Element  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: A few examples of how to use TableElement class
Class: Table Element
Generate HTML tables from the contents of cells
Author: By
Last change: Corrected class name loaded in require_once()
Date: 2005-01-10 05:07
Size: 2,758 bytes
 

Contents

Class file image Download
<?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(00"Table header");

// Second row
$Table->setCell(10"A");
$Table->setCell(11"B");

// Third row
$Table->setCell(20"C");
$Table->setCell(21"D");

$Table->setCell(30"E");
$Table->setCell(31"F");

$Table->setCell(40"G");
$Table->setCell(41"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(00"This table rows do NOT have alternated background colors");

$Table->setCell(10"click in this cell!");
$Table->setCellEvent(10"onclick""alert('Hi, this is an event fired onclick!');");
$Table->setCellStyle(10"border""2px dotted red");

$Table->setCell(11"You can define style properties to any tag");
$Table->setCellStyle(11"color""#0000cc");

$Table->setCell(20"This table has &quot;highlight footer&quot; property on");

$Table->setCell(30"And &quot;highlight header&quot; 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(00"A table with highlight header and footer on");

$Table->setCell(10"A");
$Table->setCell(11"B");

$Table->setCell(20"C");
$Table->setCell(21"D");

$Table->setCell(30"E");

$Table->setCell(40"F");
$Table->setCell(41"G");

$Table->setCell(50"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(00"But you can set the blank cell to be a row span from the cell above");

$Table->setCell(10"A");
$Table->setCell(11"B");

$Table->setCell(20"C");
$Table->setCell(21"D");

$Table->setCell(30"E");

$Table->setCell(40"F");
$Table->setCell(41"G");



$Table->row[2]->col[1]->setRowSpan(2);


$Table->create();






?>