You are here: Re: Generating listing of directory « PHP Programming Language « IT news, forums, messages
Re: Generating listing of directory

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация