<?php
/*
* Html Table and Elements
*
* Elyess Zouaghi
* elyess@zouaghi.net
* http://zouaghi.net
*/
// I will really appreciate your feedbacks, and if you can, tell me your throught about args passing for htmlElement ("attribute:value")
// and if why souldnt i use it that way or i just keep it as is.
// I prefered this method to avoid the use of array for VIEW page's, i belive it make's things easier to and simple to type
// comparing :
// $a = new htmlElement ("a", array ("href" => "some link", "text" => "anything"));
// and
// $a = new htmlElement ("a", "href:some link", "text:anything");
//
include ("html.element.php");
include ("html.table.php");
// See htmlTable class for htmlElement examples
$a = new htmlElement ("a", "href:http://zouaghi.net", "text:My homepage");
echo $a;
// Constructor
// arg0: array: headers => array, rows => array, table attributes
$table = new htmlTable ();
// push: method
// arg0: rows => array
// arg1: row (tr) attributes
$table -> set (
"headers",
array
(
"Field 1",
"Field 2",
"Field 3",
"Field 4",
"Field 5"
)
);
for ($i = 0; $i <= 10; $i++)
{
$row = array ();
for ($x = 1; $x <= 5; $x++)
{
$row [] = $x;
}
$table -> push ($row);
}
echo $table;
?>
|