PHP Classes
elePHPant
Icontem

File: TableMakerSimple.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Karsten Juul Mikkelsen  >  Table Maker  >  TableMakerSimple.php  >  Download  
File: TableMakerSimple.php
Role: Example script
Content type: text/plain
Description: Simple example
Class: Table Maker
Easy creation of HTML tables
Author: By
Last change: Updated
Date: 12 years ago
Size: 2,291 bytes
 

Contents

Class file image Download
<?php
/*
TableMakerSimple.php

An example of a simple table created with the TableMaker PHP class
*/
// Edit $includeLib so that it points to the library where TableMaker.inc is stored
$includeLib = '../PhpInclude/';

require_once (
$includeLib . 'HTMLTagMaker.inc');
require_once (
$includeLib . 'TableMaker.inc');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
    <TITLE>Simple TableMaker example</TITLE>
</HEAD>

<BODY>
<H1>Simple TableMaker example</H1>
<P>Population of the EU countries in millions (2001):</P>

<?php
$euPopTable
= new TableMaker();

   
$euPopTable -> addRow();
       
$euPopTable -> addData('Austria');
       
$euPopTable -> addData('8.1');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Belgium');
       
$euPopTable -> addData('10.3');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Denmark');
       
$euPopTable -> addData('5.4');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Finland');
       
$euPopTable -> addData('5.2');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('France');
       
$euPopTable -> addData('59.5');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Germany');
       
$euPopTable -> addData('82.2');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Greece');
       
$euPopTable -> addData('10.6');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Ireland');
       
$euPopTable -> addData('3.8');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Italy');
       
$euPopTable -> addData('57.8');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Luxemburg');
       
$euPopTable -> addData('0.4');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Netherlands');
       
$euPopTable -> addData('16.0');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Portugal');
       
$euPopTable -> addData('10.0');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Spain');
       
$euPopTable -> addData('39.5');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Sweden');
       
$euPopTable -> addData('8.9');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('United Kingdom');
       
$euPopTable -> addData('59.8');
   
$euPopTable -> addRow();
       
$euPopTable -> addData('Total');
       
$euPopTable -> addData('377.5');

$euPopTable -> writeTable();
?>
<P>Source: Eurostat</P>
</BODY>
</HTML>