Always show the Folders in FileBrowser
Im currently attempting to hack away at FileBrowser and change the way it works but im getting lost!
What i would like is for it to always show the folders and not change to "Parent Directory" now ive found the bit that works out the directory but im unsure of what i need to do to stop it from not displaying a the folders from the base directory.
Basicly i would like to achive summat like the below
Base Folder
- Folder one
----- Sub Folder One
----- Sub Folder Two
--------------- Selected Sub Sub Folder
----- Sub Folder Three
- Folder two
- Folder three
So we basicly end up with a cascading menu system. Any ideas where im to start >_<
0
This discussion has been closed.
Comments
<strong>// Get a handle on the folder being browsed $FolderHandle = opendir($Config->CurrentBrowsingDirectory);</strong> $CurrentExtension = ""; $RecordItem = true; $ThumbnailCollection = array(); while (false !== ($Item = readdir($FolderHandle))) { $RecordItem = true; if ($Item == "." || $Item == ".." || in_array($Config->CurrentBrowsingDirectory."/".$Item, $Config->FullyQualifiedHideFiles) ) $RecordItem = false; if ($Config->DisplayHiddenFiles == "false" && $Item == $Config->SelfUrl) $RecordItem = false; if ($Config->DisplayHiddenFiles == "false" && substr($Item,0,1) == "_") $RecordItem = false; if ($Config->UseThumbnails && substr($Item,0,7) == "_thumb.") { // Don't record the current item in the regular file collections, dump it into a thumbnail collection $RecordItem = false; $ThumbnailCollection[] = $Item; } if ($RecordItem) { <strong>// If dealing with a folder, add it to the folder collection if (is_dir($Config->CurrentBrowsingDirectory."/".$Item)) { $FolderCollection[] = $Item;</strong> // If not dealing with a folder, add it to the proper file collection } else { // Match the current file extension with an item in the extension library $CurrentExtension = GetExtension($Item); $KeyMatch = @$ExtensionLibrary[$CurrentExtension]; // If the match came back positive, add the file to the collection if ($KeyMatch) { $FileCollections[$ExtensionLibrary[$CurrentExtension][0]]->AddFile($Item, filesize($Config->CurrentBrowsingDirectory."/".$Item), filemtime($Config->CurrentBrowsingDirectory."/".$Item), $ExtensionLibrary[$CurrentExtension][1]); // If the match came back false, attempt to add this file to the wildcard group } elseif ($ExtensionLibrary["*"]) { $FileCollections[$ExtensionLibrary["*"][0]]->AddFile($Item, filesize($Config->CurrentBrowsingDirectory."/".$Item), filemtime($Config->CurrentBrowsingDirectory."/".$Item), $ExtensionLibrary["*"][1], $ExtensionLibrary["*"]); } // Ignore all other files } } }So, as you can see (check out the stuff in bold), I only ever look at the directory currently being browsed. In order to list all of the directories underneath this one, you'll need to add another chunk of code below this that now gets a handle on each of the items in the FolderCollection array and get's THEIR contents. You'll only be interested in the folders within them, and you'll need to add each of those to your foldercollection as well (properly related to the current browsing directory, of course).After that, there is still a big chunk of work to be done with making sure that when you click a folder, it takes you to that folder. It's not a small task, but it is possible, of course.