Hi
Ive tried many things, but can't seem to do what I want!
I have a page which outputs the directory listing, which is working fine, but I can't get the php to do the following:
write a html table, 5 cells wide, but infinite in height. and insert the names of the folders into the table in the 5-cell-wide format.
I've tried for, while loops, amongst other things, but nothing is working :-s
part of the code I have at the moment is below.
any ideas?
thanks in advance, here's the code I'm using:
$FolderTracker = 0;
$dh = opendir(".");
while ($file = readdir($dh)) {
if (is_dir ($file)) {
$FolderTracker++;
}
}
print ("<tr><td>");
print ("<br><br>");
print ("<b>Folders in the directory ($FolderTracker)</b><br><img src=\"iconsx/fade.jpg\"></td></tr>\n");
print ("<tr>\n");
print ("<td>\n");
if ($FolderTracker < 1) {
print ("<font color=\"red\"><img src=\"iconsx/nofolders.gif\" align=\"middle\"> There are no folders in this directory</font><br>\n");
} else {
print ("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n");
print ("<tr>\n");
$dh = opendir(".");
while ($file = readdir($dh)) {
if (is_dir ($file)) {
$folderpic = "<a href=\"$file\"><img src=\"iconsx/folder.gif\" border=\"0\"></a>";
$MatchPattern = "([.])";
$DetectIconsFolder = "iconsx";
$file = "<a href=\"$file\">$file</a>";
if (eregi($MatchPattern, $file)) {
} else {
if (eregi($DetectIconsFolder, $file)) {
} else {
print ("<td align=\"center\">\n");
print ("$folderpic<br> $file <br>\n");
print ("</td>\n");
}
}
}
}
closedir($dh);
print ("</tr>\n");
print ("</table>\n");
}
print ("</td></tr>\n");