PDA

View Full Version : Styling of "Index of /some_directory"??


wlcchoo
8th January 07, 06:18 AM
Hi,
Searched the forum but found nothing similar.
Anyway, this is my problem.

I have some files in a public folder and a link in my web page that points to it.
When I clicked the link, the browser will refresh the window and show all the files+subfolders in the public folder, with a title of "Index of /public_folder_for_example".

How do I use CSS to style directory listing?

Ultimately I want to put this output (the listing) in an iframe. But that's later.

Any helps?

choo

Jen
8th January 07, 06:41 AM
What's your link? Did you put index.html file?

wlcchoo
8th January 07, 07:40 AM
Hi Jen,
It's an experimental website - http://myweb/. And it has an index.html file.

In index.html, the link is created and pointed to "http://myweb/pub/". The /pub folder is in c: drive. The link works fine, it shows the like the illustration I draw below, but I want to know how to control the presentation attribute such as font type using css.

This is an illustration of the "Index of" page I'm trying to style. This actual output on different type of browser all look the same - if only I can attach a screen shot here :)

<start of illustration>
Index of /pub
Name Last modified Size Description
--------------------------------------------------------------
a.xls 8-Jan 10:00 77k
b.doc 2-Jan 17:15 260k
c.xls 6-Jan 03:20 54k
--------------------------------------------------------------
<end of illustration>


choo

wlcchoo
17th January 07, 06:10 AM
Hi,
Anyone has done this before? or is this even possible?

dbldutch
17th January 07, 12:57 PM
I believe the file list is shown because the server doesn't know what to do with the directory when no index file is found. Most servers are set to show a 404 error so people cannot simply see a list of your files.

You may be able to locally change how that page is displayed but it wouldn't work if you uploaded it to some shared hosting. I believe the file to change would be in the folder where the server was installed not in your site directory.

I have Apache running on my test server. There is a folder called error in the apache2 folder. Each one of the files in that folder includes a file from the include folder called top.html. I'm guessing if I modified that html file it would affect all of the error message pages that I see when I get an error message from apache.

I'm not recommending you do that nor am I saying that's the file to change. I just think that's what you'd be getting yourself into to style that page.

wlcchoo
18th January 07, 12:01 AM
Thanks for the reply, dbldutch.

Do you know any links that I can visit to get more information on this?

dbldutch
18th January 07, 12:54 AM
i sure don't. I'm talking hypotheticals here.

Oreo
22nd January 07, 05:42 PM
Hi wlcchoo,

As dbldutch mentioned, IF you succeed in styling the document it would only be accessible locally. Unless you plan on using it on an intranet or on your own web server, CSS is not the solution.

If you are really serious about it, PHP or another server side script is your answer. Then you'll be able to format a folder's listing as you wish with CSS.

chrishirst
25th January 07, 01:10 PM
Assuming your server is running Apache you can take a look at;

http://httpd.apache.org/docs/1.3/mod/mod_autoindex.html
and
http://www.serverwatch.com/tutorials/article.php/1131431