FancyIndexing doesn't work


#1

I am trying to customize my directory listings via .htaccess. I have put the following line in a .htaccess in the root of my site:

IndexOptions +NameWidth=* +FoldersFirst +FancyIndexing +SuppressDescription +SuppressLastModified

All of those options take effect, except for the FancyIndexing.

Is this option globally disabled? Am I doing something wrong in how I am enabling it? I did forum and Wiki searches, but best I could tell, this should work …


#2

Actually, its enabled by default. If FancyIndexing was not enabled, the HTML of the listing would look like:

[code]

Index of /web/dreamhost/apache/php

Index of /web/dreamhost/apache/php

[/code]Otherwise, if it is enabled, the HTML of the directory uses a PRE element instead with whitespace padding to provide a table listing, instead of a simple unordered list.

:cool: Perl / MySQL / HTML+CSS


#3

Ah, ok I see the difference now. I thought FancyIndexing is what provided the folder and file type icons and whatnot that you see sometimes. Any idea what I’m talking about and what option that might be? I will go do some research too and see if I can find it.

In a similar vein, does anyone have any examples of customized header.html and readme.html files? I would like to do something like shown on this page:

http://disk919.com/tmp/

I was hoping to use PHP for those files, however it seems that if the files are named anything besides .html, they won’t work. And since .html files aren’t parsed for PHP content, I seem to be stuck. (That is a third question, but I might do a seperate post about parsing .html files for PHP) I did a basic version of the header.html, just changed the background color, however I couldn’t figure out how to retain the folder location in the "Index of " sections. Obviously there must be a variable I can call in that spot but I don’t know what it is offhand since I code 90% in PHP.

Thanks for clearing up the FancyIndexing question though, it’s appreciated :slight_smile:


#4

Well I answered one of my questions … parsing .html files for PHP is super simple. Just add this to .htaccess:

AddType application/x-httpd-php .html

Unfortunately, with that enabled, Apache refuses to use my header.html and readme.html template files - even without any PHP in them! Commenting out that line causes the files to immediately work again. Apparently Apache is dead set on not allowing PHP files to be used for this purpose. :frowning:


#5

Ok, and now I have solved the other questions I had. :wink: I’m posting here just in case someone else comes across these someday.

To get the icons I was talking about, you need AddIcon directives and a copy of the apache icons folder. I copied /usr/share/apache/icons/ to a folder at the top of my apache doc root and then put in the following into my .htaccess file, which I gathered from another of my apache installs:


IndexOptions +FoldersFirst +IgnoreCase +SuppressDescription NameWidth=* +SuppressHTMLPreamble

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip .bz2
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py .php .php3
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif …
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unkown.gif


That gave me the fancy icons I was thinking of in the first place.

The last issue was using php files as customized header.html and readme.html files. This is possible only if apache thinks that .php files are text/html. If you add this line to your .htaccess:


AddType text/html .php

Then you can name your header.html file to header.php and any PHP code inside will still be parsed. I was worried that this would turn off parsing of .php files, but it doesn’t seem to have caused any problems.

Now all I have to do is come up with a cool php enabled design for my index pages. Too bad I enjoy solving problems and doing coding more then the design stuff. haha

Hope this thread can be a help to someone else as well.

Jim


#6

This is very interesting. Perhaps you could add this to the DH wiki.
Silk


#7

I also want to just say THANK YOU for following up with your answers. So often I’m trying to search for a solution to some problem and I get excited when a search turns up my EXACT problem and then I click on the topic and all it says is … “Never mind” or similar. Argh. So cheers and thanks from someone, somewhere, sometime, who will thank you for that.


#8

Hey no problem! That frustrates me too when searching forums. I would have edited the subject line to state that the problem was solved too, but it was already too late to do that.

I’ll look into the Wiki thing as well. I’ve always been intrigued by Wiki sites, but never felt like I was qualified to add anything to any of them. Maybe this is my big chance! hehe