im working on making a simple gallery maker script. so far ive got it to read the contents of a directory full of pics and ive gotten it to display all of them into a table. but what i would like to do, but dont know how to do, is to make it make separate tables for every 12 pictures that are in the directory. the ultimate would be to have it make separate php or html pages that has a table with the 12 pics in it.
like for every 12 pictures in the directory, make a table and put that table into its own file.
below is the code that ive got so far. feel free to help make improvements. thanks for your help.
### directory where the pictures are ###
$content = "../content";
$handle=opendir($content);
### edit this if you want to change the way the table is made ###
echo "<center>\n\n<p>\n\n<table border=0 width=80% cellpadding=2 cellspacing=2>\n";
$count = "0";
while ($file = readdir($handle)) {
if ($file != "." && $file != "..") {
if ($count == 0) echo "<tr>\n";
### this is the url to the files that the viewers will use, its also the link to the biiger picture ###
echo "<td valign=top><a href=http://www.everybodyneedstgp.com/content/$file><img src=http://www.everybodyneedstgp.com/content/$file width=125 height=125></a></td>\n";
$count++;
if ($count == 3) {
echo "</tr>\n";
$count = 0;
}
}
}
if ($count != 12) echo "</tr>\n";
echo "</table></center>\n";
closedir($handle);