OKay I have a snippet of code that looks really nice except when i actually execute it I end up with a blank page instead of the recursive dir's That should be expected.
ANy ideas what could be wrong here?
<?
function browse_dir($dir_name, $spaces = 0){
$dir = opendir($dir_name);
while($file = readdir($dir)){
if($file != "." && $file != "..")
if(is_dir($dir_name . $file))
$found_dirs[] = $file;
else
$found_files[] = $file;
}
closedir($dir);
for($j = 0; $j < $spaces; $j++)
echo " ";
if($found_dirs || $found_files)
echo "<img src=open.gif> " . basename($dir_name) . "<br>\n";
else
echo "<img src=closed.gif> " . basename($dir_name) . "<br>\n";
if($found_dirs){
sort($found_dirs);
for($i = 0; $i < count($found_dirs); $i++)
if($found_dirs[$i] != "." && $found_dirs[$i] != "..")
browse_dir($dir_name . $found_dirs[$i] . "/", $spaces + 1);
}
if($found_files){
sort($found_files);
for($i = 0; $i < count($found_files); $i++){
for($j = 0; $j < $spaces + 1; $j++)
echo " ";
echo "<img src=file.gif> $found_files[$i]<br>\n";
}
}
}
?>
Thnx for any help :-)