directory listing script?
- Started
- Last post
- 7 Responses
- xrusos
i'm looking for a script (preferrably javascript) that will duplicate a directory listing, but allow for html to be used as well.
basically, i just want to have a good looking directory file listing instead of the default server listing.
but instead of creating a regular static html navigation of sorts, i want it automatically updated when new files/folders are added.
any help?
- davetufts0
I'm pretty sure that directory listings are impossible with just JavaScript (since a dir is server side)
there are a couple PHP examples here:
http://us2.php.net/manual/en/cla…
(notably the last user submitted comment on the page)
- ribit0
you can use plain old Apache webserver configuration to specify a HTML header and footer file for your directory listing...not sure if it does all you want..but it's part of the directory indexing system on Apache...
I tried it, but didnt know how to get it to still include the path listing..
- xrusos0
the apache html header is probably more like what i need.
how do i set that up? i don't see any current headers on my site.
- xrusos0
added issue... i don't want a tree structure, i only want it to display the first level of files (whether it is a folder or a file), and then link appropriately.
- ribit0
might depend on your hosting... you need access to the config file httpd.conf , or a control panel that gives you access to the Directory indexing "Fancy Indexing" settings...
(I don't know this area very well..I just set it up on our dedicated unmanaged server using Webmin and it sort of worked)
- ribit0
or maybe you can set the indexing using a htaccess file in the directories you want to index...
you need to go to builder.com or somewhere and get the commands for setting the header file, footer file, and a few other 'fancy indexing' things... and drop them in the htaccess file
- xrusos0
i figured out as much as i could... thanks anyway.
[?php
function getDirList ($dirName) {
$d = dir($dirName);
while($entry = $d->read()) {
if ($entry != "." && $entry != ".." && $entry != "index.php") {
echo $dirName."/".$entry."" ?"[br] [a href=$entry]$entry[/a]" :"[br] [a href=/$entry]$entry[/a]";
}
}
$d->close();
}getDirList(".");
?]