<?php
/* **********************************************************************
make multicolumn list
********************************************************************** */
function makeList()
{
global $classname;
// define number of columns
$numcols = 2;
// define direction
$horizontal = 0;
// define table width in percent
$tablewidth = 100;
$numargs = func_num_args();
$arg_list = func_get_args();
$colwidth = floor($tablewidth/$numcols);
// table
echo "<table width="$tablewidth%" cellspacing="1" cellpadding="1" border="0" align="center">\n";
echo "<tr>\n";
// vertical direction
if($horizontal==0)
{
// define items per column
$colitems = ceil($numargs/$numcols);
// define first and last item of first column
$first = 0;
$last = $colitems;
// columns
for($i=0;$i<$numcols;$i++) {
echo "<td width="$colwidth%" class="$classname" vAlign="top">\n";
echo "<ul>\n";
// items
for($j=$first;$j<$last;$j++)echo '<li>' . $arg_list[$j] . "</li>\n";
// define first and last item of next column
$first = $colitems*($i+1);
$last=$colitems*($i+2)<$numargs?$colitems*($i+2):$numargs;
echo "</ul>\n";
echo "</td>\n";
}
}
// horizontal direction
else {
// columns
for($i=0;$i<$numcols;$i++) {
echo "<td width="$colwidth%" class="$classname" vAlign="top">\n";
echo "<ul>\n";
// items
for($j=$i;$j<$numargs;$j=$j+$numcols)echo '<li>' . $arg_list[$j] . "</li>\n";
echo "</ul>\n";
echo "</td>\n";
}
}
// table
echo "</tr>\n";
echo "</table>\n\n";
}
// test
makeList ('Feature 1','Feature 2','Feature 3','Feature 4','Feature 5','Feature 6','Feature 7','Feature 8','Feature 9','Feature 10','Feature 11');
?>