Help - Search - Members - Calendar
Full Version: Listing File Names As Links From A Folder
Zymic Webmaster Forums > Web Design & Development > Client Side Scripting > HTML and CSS
GeorgeT
I´m looking to create links from files stored in a folder (a function that takes the file names and create the links list at the page) using html, without making the links 1 at the time... I hope I make my point English is not my mother language…

Thanks
IamShipon1988
I do not think this is possible with just HTML unless you use iFrame. HTML is just mark-up language used primarily for front-end. You can accomplish this using php with the code below (adopted from xFunda). You might not want to use tables. Or you can download the Directory Indexer by CeleronDude.
CODE
<?php
/*
function that reads directory content and
returns the result as links to every file in the directory
also it disply type wheather its a file or directory
*/
function DirDisply() {

$TrackDir=opendir(".");

while ($file = readdir($TrackDir)) {

if ($file == "." || $file == "..") { }
else {
print "<tr><td><font face=\"Verdana, Arial, Helvetica, sans-serif\"><a href=$file target=_blank>$file</a></font> </td>";
print "<td>  ".filetype($file)."</td></tr><br>";

}
}
closedir($TrackDir);
return;
}

?> <b><font face="Verdana, Arial, Helvetica, sans-serif">Current Directory Contain
Following files and Sub Directories...</font></b>
<p>
<?php
@ DirDisply();
?>
Banjo
For this line here:
CODE
if ($file == "." || $file == "..") { }

Would it not be better to use a if not statement ?
IamShipon1988
Yes it is, but this is just a simple script to load from the current directory. Didn't do a review on this before posting.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.