I am pretty new to php. I've done this in asp but I can't quite figure it out. I am trying to list folders in a directory and make them link to those folders. This is the coding I have so far. Like I said I am new to php so its possibly messy and I have done my best to clean it up. My question is how do I make sure it excludes all php files in the directory and with the code I have so far is there a cleaner way to do this? Thanks in advanced.
<?php
$domain = $_SERVER['HTTP_HOST'];
$path = str_replace("default.php","", $PHP_SELF);
$url = $domain . $path;
$exclude = array("default.php",".","..","includes");
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if(!in_array($file, $exclude)) {
echo "<a href='http://$url$file/'>$file</a>\n<br />";
}
}
closedir($handle);
}
?>