Chapter 8. Custom Directory Listings

Table of Contents
Defining a template
Scripts

Directory listings are fully customizable in Abyss Web Server. If you do not like their standard look, you can provide the server with your listing template. Advanced users can do better by writing a script to generate custom listings.

Defining a template

A directory listing template is defined by its:

When generating a directory listing using a template, the server creates a special XSSI environment before processing the header, the line description for every file in the listing, and the footer. So you can (in fact, you should) use XSSI directives to insert information about every file in the generated page.

While processing the line description for a given file, the server sets the following environment variables in addition to the standard CGI environment variables:

Example 8-1. A simple directory listing template

  • MIME Type:

       text/html; charset=utf-8

  • Header:

       <HTML>
         <HEAD>
           <TITLE>
             Index of <!-- #echo var="URL" encoding="reverse-url" -->
           </TITLE>
         </HEAD>
       
         <BODY>
           <TABLE BORDER=0>
             <TR>
               <TD>Name</TD>
               <TD>Size</TD>
               <TD>Date</TD>
               <TD>MIME Type</TD>
             </TR>

  • Body Line:

             <TR>
               <TD>
                 <A HREF="<!-- #echo var="DIRLIST_FILE_URL" -->">
                   <!-- #echo var="DIRLIST_FILE_NAME" -->
                 </A>
               </TD>
               <TD> <!-- #echo var="DIRLIST_FILE_SIZE" --> </TD>
               <TD> <!-- #echo var="DIRLIST_FILE_DATE" --> </TD>
               <TD> <!-- #echo var="DIRLIST_FILE_MIME_TYPE" --> </TD>
            </TR>

  • Footer:

            </TABLE>
          </BODY>
       </HTML>