Quinn: =basename($dir); ?> listing
// open directory and parse file list
if ($dh = opendir($dir))
{
$directories = array();
echo "
";
// iterate over file list
while (($filename = readdir($dh)) !== false)
{
// if filename matches search pattern, add it to the array
if (is_dir($filename) && (($filename != ".") && ($filename != "..")))
{
array_push($directories, $filename);
}
}
arsort($directories);
while (list($key, $f) = each($directories))
{
// go into the requested dir
chdir($dir . "/" . $f);
// and find files matching pattern
$imagefiles = glob($imagePattern);
// write html
// open row and left div
echo "\n\t";
echo "\n\t";
// link this section to directory
echo "";
echo "". $f . "";
echo "";
echo " | \n\t";
echo "\n\t";
// draw one image from directory
echo " ";
// list the first 3 file names
// echo " " . $imagefiles[0] . ";\n\t ";
// echo $imagefiles[1] . ";\n\t ";
// echo $imagefiles[2] . "; (more...)\n\t";
//close row
echo " | \n\t";
echo "
\n\t";
// return to home
chdir($dir);
// increment number of directories
$count++;
} // end while
// close directory
closedir($dh);
echo "
";
}
// make sure there were valid directories
if($count == 0)
{
echo "
There are no directories currently available to view
";
}
?>