Forum Moderators: coopster
$dir = "dir/";
// Open a known directory, and proceed to read its contents
if ($dh = opendir($dir)) { // open the dir
while (($file = readdir($dh))!= false) { // read the files
$ext = explode('.',$file);
if($file!= '.' && $file!= '..' && $ext[ 1 ]=='php') {
$filearray = explode('.',$file);
$filename = reset($filearray);
$getcat = urlencode($filename);
echo "<li><a href=\"/dirindex.php?cat=$getcat\">$filename</a></li>\n";
}
}
closedir($dh);
}
[edited by: jatar_k at 4:25 pm (utc) on Aug. 14, 2004]
[edit reason] reformatted for easier reading [/edit]
[webmasterworld.com...]
[webmasterworld.com...]