Home  Contents

cgi:index

Httpd/CGI Core4 Lua Event System

SYNOPSIS

cgi:index(opt[, urn])

DESCRIPTION

Sends a directory listing to the client as a properly formatted HTML page.

When this function is called before anything else has been sent to the client, it returns a full HTML page with header and body. If it is called from within a HTML page, then only the listing itself is created.

The opt options variable is a string that configures the listing behaviour. If opt contains the letter t then the generated listing table will contain a table header with descriptive titles. The option letter h also generates a table header, which is also clickable so the user can sort by that column.

The optional parameter urn gives the directory to list. The path is taken relative to the server root. When not specified, it uses the directory path of the current file of the request.