06-10-2007, 01:08 PM
Is there a script that will automatically fill a webpage with links to all of the files in its web directory (except for itself)? It would sure be handy so all the resources (regardless of how the content changes) in a folder can be easily accessed.
Appreciate anything the geniuses can come up with! :)
06-10-2007, 02:22 PM
06-10-2007, 04:34 PM
Oh. :-( Any suggestions on how I would do this with PHP then?
06-10-2007, 05:39 PM
Not entirely correct.
If you configure your server to allow the folder listing access (on apache it is as simple as adding the following line to .htaccess: "Options +Indexes +MultiViews +FollowSymlinks"), you can use the XMLHTTPRequest to get the html file returned by the server and then parse it to extract desired file information.
06-10-2007, 08:15 PM
I don't know if it will be of use in your case, but I've written a few websites which use a PHP script to list the contents of a folder as active links. I use the following code in a file called index.php, and put it into the folder in question. Here's the code:
//define the path as relative
$path = ".";
//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");
//running the while loop
while ($file = readdir($dir_handle))
if($file!="." && $file!=".." && $file!="index.php")
echo "<a href='$file'>$file</a><br/>";
//closing the directory
06-12-2007, 11:15 AM
Hmmm, that looks like it might work! :)
06-14-2007, 10:20 AM
works like a charm!!! :-):thumbsup: