Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

recursive file browser

Asked Modified Viewed 1,619 times
I
ImproperUsername
I
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 19 threads in the forums
  • Started this discussions
asked
Member

I tested this just for fun, playing with putting code directly into the new panel box rather than making a file panel. If you don't have ftp access it is a way to see what files are available.

[size=12]

function directoryToArray($directory, $extension="", $full_path = true) {
   $array_items = array();
   if ($handle = opendir($directory)) {
      while (false !== ($file = readdir($handle))) {
         if ($file != "." && $file != "..") {
            if (is_dir($directory. "/" . $file)) {

echo "<b>". $file."</b><ul>";
               $array_items = array_merge($array_items, directoryToArray($directory. "/" . $file, $extension, $full_path));
            }
            else {
               if(!$extension || (ereg("." . $extension, $file)))
               {
                  if($full_path) {
                     $array_items[] = $directory . "/" . $file;
echo "<li>". $file."</li>";
                  }
                  else {
                     $array_items[] = $file;

                  }
echo "</ul>";
               }
            }
         }
      }
      closedir($handle);
   }
   return $array_items;
}
 



//modify the following for your path as needed
 directoryToArray("../../");




[/size]
0 replies
There are no post found.

Category Forum

Panels and Infusions

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

I
I
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 19 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet