Fully functional (abeit badly written) code:
Code:
<?php
$i = 0;
$Folder = "./Photos/";
$DirHandle = @opendir($Folder) or die($Folder." could not be opened.");
print ("<table width=40% align=center valign=center>");
while ($Filename = readdir($DirHandle))
{
if ($i == 2) print ("<tr>");
if (($Filename != ".") AND ($Filename != "..")) print ("<td width=200 height=200><img src=\"$Folder$Filename\" height=95% width=95%>$i</img></td>");
if ($i == 2) print ("<//\tr>");
if (($Filename != ".") AND ($Filename != "..")) ++$i;;
}
closedir($DirHandle);
print ("</table>");
?>
Cheers for the pointers
---------- Post added at 00:18 ---------- Previous post was at 00:15 ----------
Quote:
Originally Posted by punky
Also, another prob I spotted... your <tr> closing tag should be </tr> not <\tr>.
A backslash within a string is a special character. In this case \t = tab.
|
That causes a problem, it seems to then spit out a </tr> tag every iteration, rather then when it should be (every 2nd).
EDIT:
Also changed the closing TR tag code to:
Code:
if ($i == 4) print ("<//\tr>") AND $i = 0;
(And modified the opening tags, it now is every 4 rather than just the first 4)