I have been using a snipit I found online to display the files and folders in a directory with my PHP script. This part works fine, but I would like to be able to click the folders and get a similar html page up that displays it's contents, and beeing able to open the text files in the browser(this works fine if the text file is in the start directory).
At the moment, when I click a folder, an old school sort of page opens up with no html file in it. Is the only way to do this to create a new PHP script in each folder and link to it? I tried using the DirectoryIterator class, but it gave me an error. I dont have the snipit for DirectoryIterator anymore, but it was something like "Can't find class DirectoryIterator".
Here's the code I'm using now(working):
$arrayImports = array ();
if ($handle = opendir ($importLogPath)
{
while (false !== ($entry = readdir ()))
{
chop ($entry);
if ($entry != "." $entry != "..")
{
$arrayImports [] = "<p><a href=$importLogPath$entry target=_blank>$entry</a></p>";
}
}
closedir($handle);
}
arsort ($arrayImports);
foreach ($arrayImports as $value)
{
print "<li>$value</li>";
}
Thanks!
Are you looking for something like this? Encode Explorer
I used it for an old project... it's very cool. You can also add ajax to browse folders without refreshing the pages.
Bye