Guest_imported
New member
- Jan 1, 1970
- 0
Hi there,
I've built this page that is supposed to parse through the images directory and build an HTML table that is 4 columns wide and as long as it needs to be to get all of the images. All of the code seems to work except that it keeps repeating the same file.
BTW: This code only displays the filename in the cell so far, since I'm just trying to get the table building portion right.
Can anyone tell me why it won't advance to the next file?
I've built this page that is supposed to parse through the images directory and build an HTML table that is 4 columns wide and as long as it needs to be to get all of the images. All of the code seems to work except that it keeps repeating the same file.
BTW: This code only displays the filename in the cell so far, since I'm just trying to get the table building portion right.
Can anyone tell me why it won't advance to the next file?
Code:
<table>
<?
$thumbstr = "tn_";
$jpgext = ".jpg";
$startnum = 1;
$endnum = 4;
$handle = opendir("images/Skye");
while (false!==($file = readdir($handle)))
{
while ($file != "." && $file != ".." && strstr($file, $jpgext))
{
print("<tr>\n");
for ($colctr = $startnum; $colctr <= $endnum; $colctr++)
{
switch($colctr)
{
case 4:
print("<td>$file</td></tr>\n");
$colctr = $startnum;
break;
default:
print("<td>$file</td>\n");
break;
}
}
}
}
closedir($handle);
print("</table>");
?>