Posted by juglesh on 11/06/05 02:49
highway of diamonds wrote:
> I'm listing a directory of image files. It is quite long so i wanted to
> break it into four columns. I'm using the code below which works well
> in mozilla firefox but breaks in IE and Opera.
>
> Is there a better way of doing this?
>
> I'm using this to list them in a table of 4 columns:
>
> $flag=0;
> echo "<table width=\"80%\" border=\"1\" cellspacing=\"0\"
> cellpadding=\"3\" >";
> echo "<tr>";
>
> while($file=readdir($dir) )
> {
> $flag++;
> if ($flag<5)
> {
> echo "<td>".$file."</td>";
> }
> else
> {
> echo "</tr>";
> $flag=0;
> echo "<tr>";
> }
> }
> if ($flag<5)
> {
> echo "</tr>";
> }
> echo "</table>";
at first glance, it looks fine, but you should look at the outputted
source and see what the prob is. too many or not enough td tr tags.
stick in some /n after the </td>and</tr> to help format the source for
easy viewing.
[Back to original message]
|