Tarantulus Posted September 5, 2006 Share Posted September 5, 2006 Hi there,I got this code from another site, and I understand how it works, but I can't get the results to display as text.[code]<?phpfunction scan_directory_recursively($directory, $filter=FALSE){ if(substr($directory,-1) == '/') { $directory = substr($directory,0,-1); } if(!file_exists($directory) || !is_dir($directory)) { return FALSE; }elseif(is_readable($directory)) { $directory_list = opendir($directory); while($file = readdir($directory_list)) { if($file != '.' && $file != '..') { $path = $directory.'/'.$file; if(is_readable($path)) { $subdirectories = explode('/',$path); if(is_dir($path)) { $directory_tree[] = array( 'path' => $path, 'name' => end($subdirectories), 'kind' => 'directory', 'content' => scan_directory_recursively($path, $filter)); }elseif(is_file($path)) { $extension = end(explode('.',end($subdirectories))); if($filter === FALSE || $filter == $extension) { $directory_tree[] = array( 'path' => $path, 'name' => end($subdirectories), 'extension' => $extension, 'size' => filesize($path), 'kind' => 'file'); } } } } } closedir($directory_list); return $directory_tree; }else{ return FALSE; }}echo $directory_tree[]?>[/code]I've tried echo $directory_list [name]; and such but nothing seems to work, i need the output to have in a javascript expanding menu.hope this makes sense I am a REAL beginner Quote Link to comment Share on other sites More sharing options...
karthikeyan_coder Posted September 5, 2006 Share Posted September 5, 2006 just try this print_r($directory_list); Make sure that the array is having values... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.