HTML
|
|
|
|
<?php
/* tables.php3
*
* functions to create html tables
*
* Refer HTML questions to http://www.w3.org/TR/REC-html40/
*/
/* let other includes know we're here.. */
define("USING_TABLES", "Yup");
/* begin function declaration */
function table($border=0, $width="", $spacing="", $padding="", $args="") {
$temp = "n<TABLE border=$border";
if($width != "")
$temp .= " width="$width"";
if($spacing != "")
$temp .= " cellspacing=$spacing";
if($padding != "")
$temp .= " cellpadding=$padding";
if($args != "")
$temp .= " $args";
$temp .= ">n";
print($temp);
}
function tr($args="") {
$temp = "n<TR";
if($args != "")
$temp .= " $args";
$temp .= ">n";
print($temp);
/* possible tr $args: id, class, lang, title, style, align, char, charoff, valign, intrinsic events */
}
function td($args="") {
$temp = "n<TD";
if($args != "")
$temp .= " $args";
$temp .= ">";
print($temp);
/* possible $args: id, class, lang, title, style, bgcolor, align, char, charoff, valign, rowspan, colspan, etc */
}
function table_close() {
print("n</TABLE>n");
} ?>
|
|
|
Usage Example
|
<? include("html.php");
include("tables.php"); doctype_transitional(); html(); head(); title("Title goes here"); head_close(); body(); center();
table(0, "95%", 0, 15); tr("valign=top"); td();
p();
print("Left column, first paragraph"); p();
print("Left column, second paragraph"); td(); p();
print("Right column, first paragraph"); p();
print("Right column, second paragraph"); table_close(); center_close(); body_close(); ?>
|
|
|
Rate This Script
|
|
|
|