I have the following script for printing the first 10 files in a directory:
Which works like a charm. However, what I want is to allow the user to scroll from one page to another when there are more than 10 files in a directory.PHP Code:<?
$handle = opendir('.');
print "<table>
<tr bgcolor='#CCCCCC'>
<td>Filename: </td>
<td>File-size: </td>
</tr>";
$max = '10';
$min = 0;
while (false !== ($file = readdir($handle))) {
if ($i >= $min && $i <= $max){
if ($file != "." && $file != ".." && ereg(".php",$file)) {
$file_size = ceil(filesize ($file) / 1024);
print "<tr>
<td><a href='$file'>$file</a </td>
<td align='right'>$file_size k </td>
</tr>";
}
$i++;
}
else {
die();
}
}
closedir($handle);
?>
So: How do I change the code so that 10 files are shown at a time, printing a [next] button when there are more, showing the next 10 files?
Any help is appreciated
Jazz





Bookmarks