PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Michele Andreoli  >  Easy Table Generator  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: example of use
Class: Easy Table Generator
Display data from arrays in HTML tables
Author: By
Last change:
Date: 6 years ago
Size: 2,626 bytes


Class file image Download
 * @author Michele Andreoli <>
 * @name index.php
 * @version 0.1
 * @license GNU Public License
 * @package TableGenerator
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" xml:lang="en" lang="en">
      <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
        <link rel="stylesheet" href="index.css" type="text/css" />
        <title>Table generator</title>
require_once 'Table.class.php';

//Set table's headers
$headers = array("ID", "Name", "E-mail", "Home");
//Set table's matrix data
$data[0] = array("1", "Megan", "", "<a href=\"#\">index</a>");
$data[1] = array("2", "John", "", "<a href=\"#\">index</a>");
$data[2] = array("3", "Paul", "", "<a href=\"#\">index</a>");
$data[3] = array("4", "Michael", "", "<a href=\"#\">index</a>");
$data[4] = array("5", "George", "", "<a href=\"#\">index</a>");
$data[5] = array("6", "Jill", "", "<a href=\"#\">index</a>");
$data[6] = array("7", "Billy", "", "<a href=\"#\">index</a>");
$data[7] = array("8", "Steve", "", "<a href=\"#\">index</a>");

"<h1 style=\"text-align: center\">Table exemple</h1>";

             * Create an instance of Table class
             * @param <Boolean> true: zebra rows on, false: zebra rows off
             * [@param] <String> table id
             * [@param] <String> table class
$t = new Table(true, "tableID");
             * Set a class or id for thead, tbody and tfoot of table
             * @param <String> class name
             * [@param] <String> id name

             * Specify a width for every columns
$t->setColumnsWidth(array("20px", "150px", "150px", "80px"));

             * Show the table
             * @param <Array> headers
             * @param <Array> data
$t->showTable($headers, $data);