htsearch

ht://Dig © 1995-1998 Andrew Scherpbier
Please see the file COPYING for license information.


Output Templates

The htsearch program will normally produce HTML output. In this process it makes extensive use of template in which variables will be substituted. The templates are specified in the configuration file. The configuration file attributes defining these templates are:

In addition to these files, the search results are also produced with the use of templates. The result templates are a bit more complicated because they can be specified at runtime using an HTML menu. They are specified using the template_map configuration file attribute. This attribute contains a list of strings triplets. For each triplet of strings, the elements have the following meaning:

  1. the name that will appear in the FORMAT menu (see below)
  2. the internal name used by htsearch for this result template
  3. the base filename for the template.

There are two predefined templates that are used by default. They have the internal names builtin-long and builtin-short. As such, the default value for the template_map attribute is as follows:

Long builtin-long builtin-long \ Short builtin-short builtin-short
Which means that there will be two ways to display the search results: a "Long" and a "Short" way. The first template listed will always be the default one for the first search. Thereafter, the default will be whatever was selected for the previous search.

Result template files

When a custom template is required, one or more template files need to be created and referenced in the template_map attribute.

There are many variables that can be substituted into these templates. Not all of them make sense for each file, so not all of them will be substituted for every file. The variables are:

CGI
This expands to whatever the SCRIPT_NAME environment variable is.
CURRENT
The number of the current match.
DESCRIPTION
The first link text description for the matched document.
DESCRIPTIONS
A list of link text descriptions for the matched document. The entries in the list are separated by <br>. These are the text used between tags.
DOCID
The internal ID for the document for the current match.
EXCERPT
The relevant excerpt for the current match
FIRSTDISPLAYED
The index of the first match on this page.
FORMAT
Expands to an HTML menu of all the available formats. The current format will be the default one.
HOPCOUNT
The distance of this match away from the starting document(s).
LASTDISPLAYED
The index of the last match on this page.
LOGICAL_WORDS
A string of the search words with either "and" or "or" between the words, depending on the type of search.
MATCH_MESSAGE
This is either all or some depending on the match method used.
MATCHES
The total number of matches that were found.
MATCHES_PER_PAGE
The configured maximum number of matches on this page
MAX_STARS
The configured maximum number of stars to display in matches.
METHOD
Expands to an HTML menu of all the available matching methods. The current method will be the default one.
MODIFIED
The date and time the document was last modified
NEXTPAGE
This expands to the value of the next_page_text or no_next_page_text attributes depending on whether there is a next page or not.
PAGE
The current page number.
PAGEHEADER
This expands to either the value of the page_list_header or no_page_list_header attributes depending on how many pages there are.
PAGELIST
This expands to a list of hyperlinks using the page_number_text and no_page_number_text attributes.
PAGES
The total number of pages.
PERCENT
The match score as a percentage. Its range is 0 to 100, without a percent sign.
PLURAL_MATCHES
If the MATCHES variable is other than 1, this will be a single 's'.
PREVPAGE
This expands to the value of the prev_page_text or no_prev_page_text attributes depending on whether there is a previous page or not.
SCORE
The score of the current match
SELECTED_FORMAT
The currently selected format.
SELECTED_METHOD
The currently selected method.
SIZE
The size of the document for the current match
SIZEK
The size in kilobytes of the document for the current match
STARSLEFT
A set of HTML <img> tags with the stars aligned on the left.
STARSRIGHT
A set of HTML <img> tags with the stars aligned on the right.
SYNTAXERROR
Is the text of the boolean expression syntax error.
TITLE
The title of the document for the current match
URL
The URL to the document for the current match
VERSION
The ht://Dig version number
WORDS
A string of the search words with spaces in between.

Andrew Scherpbier <andrew@contigo.com>
Last modified: Mon Jun 16 08:34:11 PDT