Guest_imported
New member
- Jan 1, 1970
- 0
Apologies if the code below looks somewhat jumbled. Cut and paste problems ) Basically what it does is reads all the .htm files in a directory and displays them on a php page (with different names). At the moment it is only displaying them in one column (each file a different row), but I'd like to be allowed to set the number of columns, e.g. 6. I thought I had this set up but it isn't working. Any ideas? Where do I put the <td> and <tr> tags??
thanks,
Gizmo
thanks,
Gizmo
Code:
<?
/* DECLARATIONS */
$col = 1;
$numcols = 6;
$p = "results";
$d = opendir($p);
$f = readdir($d);
echo("<p align='center' class=gen><u><b>Results</b> (please click on a link below)</u><br> <br><table cellSpacing=2 cellPadding=1 bgColor=#e6e6e6 border=0>");
while($f !== false)
{
if($f != "." and $f != ".." and $f != "index.htm") {
if($col ==1) {
echo("<tr>");
$prettyname = $f;
$prettyname = eregi_replace("jan", "January ", $prettyname); }
$prettyname = eregi_replace("feb", "February ", $prettyname);
$prettyname = eregi_replace("mar", "March ", $prettyname);
$prettyname = eregi_replace("apr", "April ", $prettyname);
$prettyname = eregi_replace("may", "May ", $prettyname);
$prettyname = eregi_replace("jun", "June ", $prettyname);
$prettyname = eregi_replace("jul", "July ", $prettyname);
$prettyname = eregi_replace("aug", "August ", $prettyname);
$prettyname = eregi_replace("sep", "September ", $prettyname);
$prettyname = eregi_replace("oct", "October ", $prettyname);
$prettyname = eregi_replace("nov", "November ", $prettyname);
$prettyname = eregi_replace("dec", "December ", $prettyname);
$prettyname = eregi_replace(".htm", "", $prettyname);
echo("<td bgColor=white valign='center' align='center'>"); echo(" <a href=results/$f>$prettyname</a> ");};
$f = readdir($d) ; }
echo("</td>");
$col++;
if($col-1 == $numcols) {
echo("</tr>");
$col=1;
}
// }
echo("</tr></table></p>");
closedir($d);
?>