Reply to Message

tables.php
Verbatim
?php

// string start_table ([array attributes])


// This function returns an opening HTML tag, inside an
// opening paragraph ( ) tag. Attributes for the table may be supplied
// as an array.

function start_table ($atts="")
{
$attlist = get_attlist($atts);
$output = EOQ


EOQ;
return $output;
}

// string end_table (void)

// This function returns a closing tag, followed by a closing
// paragraph ( ) tag. (Presumably closing the paragraph opened by
// start_table().)

function end_table ()
{
$output = EOQ


EOQ;
return $output;
}

// string table_cell ([string value [, array attributes]])

// This function returns an HTML table cell ( ) tag. The first
// argument will be used as the value of the tag. Attributes for the
// "top"));

$output = EOQ
$value
EOQ;
return $output;
}

// string table_row ([mixed ...])

// This function returns an HTML table row ( ) tag, enclosing a variable
// number of table cell ( ) tags. If any of the arguments to the function
// is an array, it will be used as attributes for the tag. All other
// arguments will be used as values for the cells of the row. If an
// argument begins with a tag, the argument is added to the row as is.
// Otherwise it is passed to the table_cell() function and the resulting
// string is added to the row.

function table_row ()
{
$attlist = "";
$cellstring = "";

$cells = func_get_args();
while (list(,$cell) = each($cells))
{
if (is_array($cell))
{
$attlist .= get_attlist($cell);
}
else
{
if (!eregi(" td",$cell))
{
$cell = table_cell($cell);
}
$cellstring .= " ".trim($cell)."\n";
}
}
$output = EOQ

$cellstring
Posted by Jaqui
6th Apr 2005