man ample.html (Formats) - html template for Ample
NAME
ample.html - html template for Ample
DESCRIPTION
This file, by default /etc/ample.html, is read by Ample at startup and used as a base for it's HTML pages. These pages are rendered whenever a webbrowser connects and requests a list of available songs and directories (typically done by connecting to http://server:port/index.html).
The file is divided into three sections, the header, the middle and the footer. The header and the footer are the same on each page generated while the “middle†is copied into the final HTML document once for each file or directory that is going to be listed. Although this may sound confusing, it will probably become much more evident once you look at the example below.
Variables are written in uppercase and enclosed within “at†signs (example: @NAME@) and are replaced dynamically when the page is constructed. Some variables can exist anywhere in the document and some can only exist in the “middle†section, see the information about each variable for details.
EXAMPLE
-
<!-- Beginning of header --> <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//ENâ€> <html><head> <title>@SERVERNAME@</title> </head><body> <center> <p><h1>@SERVERNAME@</h1></p> <p><h2>Tracks currently available in @PATH@</h2></p> <p><font size=“-1â€>[ <a href=“index.m3uâ€>playlist for this dir</a> | <a href=“rindex.m3uâ€>recursive playlist</a> ] </font></p> <p><font size=“-1â€> [ <a href=“../index.htmlâ€>Up one level</a> ] </font></p> <div align=“centerâ€> <table border=“1†cellspacing=“0†cellpadding=“0†bordercolor=“#000000â€> <tr><td> <b>TYPE</b> </td><td> <b>URL</b> </td></tr> <!-- End of header --> @BEGIN@ <!-- Beginning of “middle†--> <tr><td> @TYPE@ </td><td> <a href=“@URL@â€>@NAME@</a> </td></tr> <!-- End of “middle†--> @END@ <!-- Beginning of footer --> </table> </div> <p align=“rightâ€><font size=“-1â€> powered by Ample, for more information, see the <a href=“http://ample.sourceforge.netâ€>project homepage</a> </font></p> </center> </body> </html> <!-- End of footer -->
SUMMARY OF VARIABLES
-
SPECIAL - Only used once BEGIN END
-
GLOBAL - Can be used anywhere SERVERNAME PORT PATH
-
NON-GLOBAL - Can only be used in the â€middle“ section NAME URL LENGTH TITLE SIZE TYPE
-
-
SPECIAL VARIABLES
These can only be used once.
- BEGIN
- This variable (when placed in the beginning of a new line) marks the end of the header section and the start of the â€middle“ section.
- END
- This variable (when placed in the beginning of a new line) marks the end of the â€middle“ section and the start of the footer section.
GLOBAL VARIABLES
These can be used anywhere.
- SERVERNAME
- The name of the server as given in ample.conf(5).
- PORT
- The port that the server is listening to.
- PATH
- The current path the user is viewing.
NON-GLOBAL VARIABLES
These can only be used in the “middle†section.
- NAME
- The name of the song or directory.
- URL
- The URL of the song or directory.
- LENGTH
- The song length (in seconds) or blank if it is a directory.
- TITLE
- The title of the song or “DIR†if it is a directory.
- SIZE
- The file size or blank if it is a directory.
- TYPE
- “FILE†if it is a file or “DIR†if it is a directory.
AUTHOR
David Härdeman <david@2gen.com>
SEE ALSO
ample(1), ample.conf(5)