|
Posted by Krustov on 11/12/06 14:16
<comp.lang.php>
<dougawells@gmail.com>
<11 Nov 2006 22:01:01 -0800>
<1163311260.976045.298590@k70g2000cwa.googlegroups.com>
> I'm hoping for help with the auto-generation of a hyperlinked listing
> of all files in a directory. The server I use does not auto-generate
> this. So, when someone comes to this directory and thus opens
> index.htm, I want that file to show a listing of all files in the
> directory with hyperlinks to them.
>
This only shows .jpg files , Remove the (if stuff) from the following to
display everything .
<html>
<head>
<title>?</title>
</head>
<body>
<?php
$batman=0;
$dir="chatroom/images";
$joker=opendir($dir);
while (false!==($boywonder=readdir($joker)))
{
$files[]=$boywonder;
$batman=$batman+1;
}
$temp=0;
while ($temp<$batman)
{
$demo=$files[$temp];
$riddler=strlen($demo);
$penguin=substr($demo,$riddler-4,4);
if ($penguin==".jpg")
{
$link="$dir" . "/" . "$demo";
print "<a href=$link>$demo</a><br>";
}
$temp=$temp+1;
}
?>
</body>
</html>
--
www.phpchatroom.co.uk
Navigation:
[Reply to this message]
|