This script runs twice making the image appear 2x's then going on to the next image. I would like to change the div class=col$i every picture till it gets to the condition. Any help?
PHP Code:
$ext =' 1.jpg';
if ($handle = opendir('images/gallery_indiv')) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$i=1;
while($i<=2)
{
$thelist .= '<div class="col'.$i.'"><a href="gallerytest.php?dir='.$file.'"><img src="images/gallery_indiv/'.$file.'/'.$file.$ext.'" width="300"></a><div class="name">'.$file.'</div></div>';
$i++;
}
}
}
closedir($handle);
}
echo $thelist;
If I set it up like this my server runs into an infinate loop till I run out of allocated memory.
PHP Code:
$ext =' 1.jpg';
if ($handle = opendir('images/gallery_indiv')) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$i=1;
while($i<=2)
{
$thelist .= '<div class="col'.$i.'"><a href="gallerytest.php?dir='.$file.'"><img src="images/gallery_indiv/'.$file.'/'.$file.$ext.'" width="300"></a><div class="name">'.$file.'</div></div>';
}
$i++;
}
}
closedir($handle);
}
echo $thelist;
Bookmarks