Index Template Files

Index template files specify the format of the body of an HTML index file. They always begin with a <BODY> tag and end with a </BODY> tag. They contain HTML tags, text, and special tokens. The HTML tags and text are copied directly to the generated index file. The tokens are replaced with variable data, as described below.

Index template files are specified by using the template option in the configuration file.

Tokens

Tokens are placeholders for variable data which is inserted into the generated index file. The syntax of tokens is very similar to the syntax of HTML tags, except that the opening "<" is replaced by "${" and the closing ">" is replaced by "}". The token syntax is as follows:
${name}   or,
${name [attribute=value [attribute=value [...]]}
Where,
name is the name of the token (case-insensitive).
attribute is the name of an attribute (case-insensitive).
value is the value of an attribute. If the attribute contains non-alphanumeric characters or spaces, then it should be enclosed in single or double quotes. You may use \" or \' to represent a quote within quotes, or use \\ to represent a single backslash.

The following tokens are supported. Optional attributes are shown indented below their respective tokens.

${back}  Inserts a backlink to the parent directory (HTML). This normally displays the "home.gif" icon which is located in the icons directory, but it may display text instead, depending on the backlink type specified in the configuration file. It may also contain a block of JavaScript code.
${iconDir}  Inserts the path to the icons directory (URL). This is normally used in the form "${iconDir}/filename".
${img}  Inserts an HTML <IMG> tag at the current position, with the proper HEIGHT and WIDTH attributes. The tag will appear as follows: <IMG SRC="url" WIDTH=width HEIGHT=height attributes>. The url and attributes are specified (see below), and the width and height are obtained directly from the image file. Either the "src" or the "icon" attribute (but not both) must be specified for this token.
   src=url The URL that will appear as the value of the SRC attribute in the <IMG> tag. This should be a relative URL, and should reference an image file that currently exists in the file system.
   icon=filename The name of an image file that currently exists in the icons directory. The full path will appear as the value of the SRC attribute in the <IMG> tag. The path will be the same as "${iconDir}/filename".
   attrib=attributes HTML attributes that will be included in the <IMG> tag. The SRC, WIDTH, and HEIGHT attributes are inserted automatically, and should not be included here.
${index}  Inserts the index list(s) using the format specified in the configuration file (HTML). This may consist of one or more lists or tables, and headings where appropriate. The HTML content generated by this token is designed to be stand-alone, and should not be nested within inline or block-level HTML elements (e.g. <CENTER>${index}</CENTER> is illegal).
${list}  Inserts a single list of links at the current position (HTML). The list may contain links to files, links to directories, or both. If a format is not specified with the "format" attribute, a pre-defined default format will be used. This token may be nested within block-level HTML elements (e.g. <CENTER>${list}</CENTER>).
   fileLinks Includes only links to individual files (including slides) in this list -- not links to directories.
   dirLinks Includes only links to directories in this list -- not links to individual files (or slides).
   heading=text Heading text that will appear if the list is not empty. The characters &, <, and > must be encoded as HTML character entities.
   type=type Determines the type of the index. type can be one of the following:
"simple" = one entry per line,
"bullet" = unordered list (<UL>) [default],
"thumbnail" = list of thumbnails only, each separated by a single space.
   format=format Determines the format of each entry in the index. format is a format string enclosed in quotes, which defines the way in which list entries will appear. It defaults a pre-defined format. This attribute is ignored if type=thumbnail.
   nowrap Prevents lines from wrapping by converting all spaces to non-breaking spaces (&nbsp;). This attribute is ignored if type=thumbnail.
${table}  Inserts a single table of links at the current position (HTML). The table may contain links to files, links to directories, or both. If a format is not specified with the "format" attribute, the default format will be used, which is specified by the configuration file. This token may be nested within block-level HTML elements (e.g. <CENTER>${table}</CENTER>).
   fileLinks Includes only links to individual files (including slides) in this table -- not links to directories.
   dirLinks Includes only links to directories in this table -- not links to individual files (or slides).
   heading=text Heading text that will appear if the table is not empty. The characters &, <, and > must be encoded as HTML character entities.
   format=format Determines the format of each entry in the index. format is a format string enclosed in quotes, which defines the way in which table entries will appear. It defaults to the value specified in the configuration file.
     columns=columns Specifies the number of columns in the table. This option is only available when the "format=format" attribute is used. It defaults to the value specified in the configuration file.
     hPadding=pixels Specifies the padding, in pixels, between the columns in a multi-column index. This option is only available when the "format=format" attribute is used. It defaults to the value specified in the configuration file.
     vPadding=pixels Specifies the padding, in pixels, between the rows in the index. This option is only available when the "format=format" attribute is used. It defaults to the value specified in the configuration file.
     iPadding=pixels Specifies the padding, in pixels, between fields in an index entry. This option is only available when the "format=format" attribute is used. It defaults to the value specified in the configuration file.
     attrib=attributes HTML attributes that will be included in the <TABLE> tag. This option is only available when the "format=format" attribute is used. It defaults to "BORDER=0 CELLPADDING=0 CELLSPACING=0".
     tr=attributes HTML attributes that will be included in the <TR> tags. This option is only available when the "format=format" attribute is used. It defaults to "VALIGN=MIDDLE".
     td=attributes HTML attributes that will be included in the <TD> tags. This option is only available when the "format=format" attribute is used. It defaults to empty (no attributes).
${thumb}  Inserts the thumbnail for the current directory (HTML <IMG> tag), or blank if there is no thumbnail.
   attrib=attributes HTML attributes that will be included in the <IMG> tag. These attributes must not include HEIGHT and WIDTH, because they are inserted automatically.
${nothumb}  Inserts the thumbnail for the current directory (HTML <IMG> tag), or the default thumbnail if there is no thumbnail.
   attrib=attributes HTML attributes that will be included in the <IMG> tag. These attributes must not include HEIGHT and WIDTH, because they are inserted automatically.

In addition, all of the tokens that are allowed in Format Strings are also supported.

Conditional Tokens

Some special tokens are used to conditionally include or remove a section of code from the generated index. Unlike other tokens, these tokens are not actually placeholders for variable data, but instead are used to conditionally include the text and tokens that follow. In addition, if a newline (end-of-line) immediately follows one of these special tokens, it will be ignored, and will not be included in the generated index file.

${if}  If all of the attributes are true, then everything up to the next ${else} or ${endif} token will be included in the generated index file. If the attributes are false, then everything up to the next ${else} or ${endif} token will not be included in the generated index file. This token should include at least one attribute.
   desc True if the index contains a description.
   thumb True if a thumbnail exists for the current directory.
   fileLinks True if the index list contains one or more links to files.
   dirLinks True if the index list contains one or more links to directories.
   thumbLinks True if a thumbnail exists for at least one file or directory in the index list.
   not Inverts the logic of the if token (if any of the attributes are false).
${else}  Marks the optional else section of an if/else construct.
${endif}  Marks the end of an if/else construct.

The fileLinks, dirLinks, and thumbLinks attributes can be combined as shown in the following examples:

${if fileLinks dirLinks}  True if the index list contains one or more links to files or directories.
${if thumbLinks}  True if the index list contains one or more links to files or directories with thumbnails. Note: this is the same as "${if fileLinks dirLinks thumbLinks}".
${if dirLinks thumbLinks}  True if the index list contains one or more links to directories with thumbnails.
${if fileLinks thumbLinks}  True if the index list contains one or more links to files with thumbnails.
${if not fileLinks thumbLinks}    True if the index list does not contain any links to files with thumbnails.

Example

<BODY>
<CENTER>
${back}
<P>
${if thumb}
${thumb attrib="BORDER=2"}<BR>
<STRONG>${title}</STRONG><BR>
${description}
${else}
<FONT SIZE=5><STRONG>${title}</STRONG></FONT><BR>
${description}
${endif}
</CENTER>
<P>
<CENTER>
Keywords: ${keywords}<BR>
Template: ${iconDir}/template.htm<BR>
</CENTER>
<P>
${if fileLinks thumbLinks}
<CENTER>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=10 BGCOLOR=WHITE>
<TR><TD>${table
  tr="ALIGN=CENTER"
  hPadding=12 vPadding=20
  format="<?A>${thumb}<?BR>${title}</A>"
  columns=4}</TD></TR>
</TABLE>
</CENTER>
${else}
${if dirLinks}
<CENTER>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=10 BGCOLOR=WHITE>
<TR><TD>${table dirLinks}</TD></TR>
</TABLE>
</CENTER>
${endif}
${if dirLinks}${if fileLinks}<P>${endif}${endif}
${if fileLinks}
<CENTER>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=10 BGCOLOR=WHITE>
<TR><TD>${table fileLinks}</TD></TR>
</TABLE>
</CENTER>
${endif}
${endif}
</BODY>

Copyright © 1996-1999 Christopher P. LaRosa. All Rights Reserverd.