note 10437 deleted from class.dir by philip
| From: | philip@php.net | Date: | Thu, 22 Nov 2001 10:11:04 +0000 |
| Subject: | note 10437 deleted from class.dir by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-21147@lists.php.net to get a copy of this message | ||
Well, This got denied from Freshmeat, but I know it will be useful here.
This will generate HTML links for anything in a Direcory.
<html>
<body bgcolor="#000000" link="#6600cc" vlink="#6600CC"
alink="#6600CC" text="#FFFFFF">
<font face="Arial,Helvetica" size="2" color="#6600CC"> <b>
<center>
<p> </p>
<?php
$d = dir("./");
$path = "SET THIS TO THE TOP DIRECTORY";
$dir = getcwd();
list($crap, $dir) = split("$path/", $dir);
while($entry=$d->read()) {
$url = ("$dir" . "$entry");
$url = ereg_replace(" ", "%20", $url);
if ($entry != "." && $entry != ".." && $entry !=
"index.php") {
echo "<a
href=\"$url\""."target=_parent>".$entry."</a><br>\n";
}}
$d->close();
?>
</center>
</b>
</font>
</body>
</html>
The only catch is you need to set $path to a starting dir, but you can copy the index.php to any
subdirs without changing the $path.