function multicolumn ($items, $type, $rows, $columns, $table_attributes, $td_attributes, $empty_attributes
{
$return = ''
$count = count$items);
// compute number of columns and rows
if (($rows=='*') && ($columns=='*')) {
$rows = roundsqrt$count));
$columns = ceil$count$rows);
} else {
if ($rows=='*'
$rows = ceil$count$columns);
else if ($columns=='*'
$columns = ceil$count$rows);
}
if ($count>0) {
$return .= "<table $table_attributes>"
$column = 0;
$row = 0;
$total = $rows * $columns
for ($i=0;$i$total$i++) {
if$column == 0)
$return .= '<tr>'
if ($type=='horizontal'
$spot = $i
else
$spot = $row$column$rows
if ($spot$count
$return .= "<td $td_attributes>$items[$spot]</td>"
else
$return .= "<td $empty_attributes></td>"
$column++;
if ($column==$columns) {
$return .= '</tr>'
$column = 0;
$row++;
}
}
$return .= '</table>'
}
return $return
}