OK, doing this opens pandora's box, but also a lot of cool capabilities as well, too numerous to count.. Even without PHP, it's still totally doable...
One way:
Turn on XHTML file listings in Apache. Go to your /etc/apache2/httpd.conf, make sure you've uncommented
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
as well as turned off any IndexOptions you may have and replace them with these...
IndexOptions XHTML SuppressHTMLPreamble Type=text/xml
Restart apache, browse to your configured VirtualHost.. and you should have a nicely styled file listing, with source that resembles this...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Index of /dir/CRUD</title>
</head>
<body>
<h1>Index of /dir/CRUD</h1>
<ul><li><a href="/dir/"> Parent Directory</a></li>
<li><a href="CRUD.aspx"> CRUD.aspx</a></li>
<li><a href="CRUD.aspx.cs"> CRUD.aspx.cs</a></li>
<li><a href="member.xml"> member.xml</a></li>
<li><a href="web.config"> web.config</a></li>
</ul>
<address>Apache/2.2.17 (Unix) PHP/5.3.4 Server at yourserver,net Port 80</address>
</body></html>
As you can see, this is a fairly simple, valid XML file with whatever directory you're trying to list. Now, with a list of files in XML at your disposal, you can get as creative as you want in terms of styling, parsing, and doing with it as you please... You could easily setup an automated gallery that will show every file in the folder, or you could generate a javascript array with the info and perform a myriad other RSS, JSON, or whathaveyou functions with it.
Another way, does't require any changes to your apache IndexOptions, but they DO need to be enabled...
Create two HTML files on your server...
test.htm
<html>
<head>
<script>
function reload_main() {
window.main.location.href = "main.htm";
}
</script>
</head>
<frameset rows="*,1" onLoad="reload_main()">
<frame src="blank.htm" name="main">
<frame src="css/" name="directory">
</frameset>
</html>
main.htm
<html>
<body>
<h1>Contents of directory</h1>
<script>
var links_length = parent.directory.window.document.links.length;
var link = "";
for (var i = 0; i < links_length ; i++) {
link = parent.directory.window.document.links[i].href;
document.write(
'<a href="'+link+'">'+link+'</a><br>'
);
}
</script>
<p><a href="index.htm" target="_parent">Return</a>
</body>
</html>
This will get you the same thing, basically, but embedded in an invisible iFrame. Still, you can extract the subsequent <li><a href="baboon.png"> baboon.png</a></li> items and manipulate your XML to do whatever you want.