$table) {
if (array_key_exists(0, $table)) {
// Horizontal table (multiple items)
$headers = array_keys($table[0]);
//$rows = array_map('array_values', $table);
$rows = array();
//echo("table:\n"); print_r($table); echo("\n");
foreach ($table as $row) {
//echo("row:\n"); print_r($row); echo("\n");
$rows[] = array_values($row);
}
}
else {
// Vertical table (one item)
$headers = array('Field', 'Value');
$rows = array();
foreach ($table as $col => $val) {
$rows[] = array($col, $val);
}
}
foreach($rows AS &$row) {
foreach ($row AS &$cell) {
if (is_array($cell))
$cell = "<ARRAY>";
}
}
//echo("headers:\n"); print_r($headers); echo("\n");
//echo("rows:\n"); print_r($rows); echo("\n");
?>
tableHeaders($headers);
echo $html->tableCells($rows, null, array('class' => "altrow"));
?>