Page 2 of 2
Posted: Mon Dec 15, 2003 7:07 am
by dull1554
god can i be stupid sometimes, you have to give me some credit, it was like 12:00 my time, but anyways i got it womewhat fixed, i tried to use your codeand i get this returned
i just defined start_from as zero ( index.php?start_from=0)
i've been looking at it for a bit now and i can't figure out my problem, so if you could tell me what im doing wrong......thanks
Posted: Mon Dec 15, 2003 7:32 am
by dull1554
i know what has to be done to get this to work but i dont know how to do it,
Code: Select all
<?php
$max_per_page=10;
$start_from=$_GET['start_from'];
$folder = "images/"; //folder name
if($handle = opendir($folder)) //open the folder
{
$i=0;
while($files = readdir($handle)) // $files will loop through every file in the directory
{
if ($files != "." && $files != "..") // readdir returns "." and ".." but they arent' actual files, so strip them out
{
if($i<$start_from) continue;
elseif ($i<$start_from+$max_per_page) break;
else echo "<center><img src=".$folder.$files."></center><br>";
}
}
}
echo "
<ahref='index.php?start_from=".$start_from-$max_per_page."'>
Prev</a>
<ahref='index.php?start_from=".$start_from+$max_per_page."'>
Next</a>";
?>
what it is that i think has to be done is, well $i is the # of images in the given directory, somehow $i has to increase by one for every picture in the folder.
but heres another problem, i tried to do this
i set $i to the number of pictures in the given directory, but to no avail , the page displayed all 17 pictures and the
i really hope i can get this to work, and please if anyone has a soultion it would be greatly appreciated.
Posted: Mon Dec 15, 2003 8:31 am
by dull1554
hhhhheeeeeeeelllllllllllllllppppppppppp please, i've tried and tried and tried but to no avail i can't figure it out
Posted: Mon Dec 15, 2003 11:34 am
by dull1554
i'll repost in a diferent topic