//display files in a directory - alpha sorted echo '
'; $dir = "../booklist/"; //directory name if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (($file != ".") && ($file != "..") && ($file != "index.php")) { //edit this line to exclude files if(substr($file,0,4)=="book"){ $myimgfiles[] .= $file; } } } closedir($dh); } } //alphabetize sort($myimgfiles); //print them out $mycount = 0; $pagecontent = "| \n";
foreach ($myimgfiles as $key => $value) {
$bfile = substr($value,0,13);
$bfile = str_replace("-"," ",$bfile);
$bfile = str_replace("b","B",$bfile);
$pagecontent .= '' . $bfile . " \n"; $mycount = $mycount + 1; if($mycount >5){ $pagecontent .= " | "; $mycount = 0; } } $pagecontent .= " |