j  � ht://Dig: htsearch� � 0  

htsearch



W ht://Dig Copyright © 1995-2002 The ht://Dig Group
8 Please see the file COPYING for license information.




 Output Templates



B 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 theA 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. 
  3. = the internal name used by htsearch for this result template
  4. 
  5. % the base filename for the template.
  6. 


? 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 searchA results: a "Long" and a "Short" way. The first template listed7 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



A When a custom template is required, one or more template filesA need to be created and referenced in the template_mapA attribute. These templates are user-selectable from the search@ form. It is also possible to select result templates based on0 URL patterns of the search matches, using theD template_patterns attribute. This allows distinct visual8 styles to be used for matches on different web sites.



> There are many variables that can be substituted into these> templates. Not all of them make sense for each file, so notC all of them will be substituted for every file. In addition, all? of the standard CGI environment variables are available, and? listed in the cgi< specification. Variables will be substituted normally< with the format $(VAR), escaped for use in a URL with the@ format $%(VAR), URL-encoding decoded with the format $=(VAR),? and HTML-escaped with the format $&(VAR). The variables are:



 ANCHOR

C Expands to the named anchor found just before the first match; itE includes "#" at the start so it can be directly appended to the URL4 variable. If no anchor was found, ANCHOR is empty.

( CGI

7 Unless the configuration file sets a different value,6 this expands to whatever the SCRIPT_NAME environment variable is. See the2 script_name4 configuration file attribute for more information.

 CURRENT

" The number of the current match.

 DESCRIPTION

5 The first URL description for the matched document.

 DESCRIPTIONS

? A list of URL text descriptions for the matched document. The@ entries in the list are separated by <br>. These are the= text used between the <a href...> and </a>tags.

 DOCID

9 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.1 The menu is composed of choices itemized in the4 template_map7 attribute. The expansion of this template variable is! described in more detail in the= select list documentation.

 HOPCOUNT

3 The distance of this match away from the starting document(s).

 KEYWORDS

< A string of the search keywords with spaces in between, as5 specified in the keywords input parameter.

LASTDISPLAYED

+ The index of the last match on this page.

LOGICAL_WORDS

8 A string of the search words with either "and" or "or"5 between the words, depending on the type of search.

MATCH_MESSAGE

C This is either all or some depending on the match method used.

 MATCHES

. The total number of matches that were found.

# MATCHES_PER_PAGE

7 The configured maximum number of matches on this page

 MAX_STARS

6 The configured maximum number of stars to display in matches.

" METADESCRIPTION

> The meta description text (if any) for the matched document.

 METHOD

7 Expands to an HTML menu of all the available matching6 methods. The current method will be the default one.1 The menu is composed of choices itemized in the4 method_names7 attribute. The expansion of this template variable is! described in more detail in the= select list documentation.

 MODIFIED

2 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.

NSTARS

> The number of stars calculated for this document as an4 integer, up to a maximum specified by the max_stars attribute.

 PAGEB

M The current page number.

E PAGEHEADER 

) This expands to either the value of thel? page_list_header oroB no_page_list_header3 attributes depending on how many pages there are.i

 PAGELIST"

>0 This expands to a list of hyperlinks using the@ page_number_text andB no_page_number_text attributes.e

t PAGES

 The total number of pages.

i PERCENT

n9 The match score as a percentage. Its range is 1 to 100, 8 without a percent sign. The minimum is always 1 so the5 variable can be used as the value for an HTML WIDTHh attribute.

e! PLURAL_MATCHES

=E If the MATCHES variable is other than 1, this will< be a single 's'.

o PREVPAGE_

<" This expands to the value of the; prev_page_text or<> no_prev_page_textB attributes depending on whether there is a previous page or not.

 SCORE

The score of the current match

n" SELECTED_FORMAT

p The currently selected format.

" SELECTED_METHOD

e) The currently selected matching method.l

< SELECTED_SORT

n( The currently selected sorting method.

n SIZEf

l0 The size of the document for the current match

< SIZEK

e= The size in kilobytes of the document for the current matcha

- SORTi

6 Expands to an HTML menu of all the available sorting6 methods. The current method will be the default one.1 The menu is composed of choices itemized in thei0 sort_names7 attribute. The expansion of this template variable ise! described in more detail in theh= select list documentation.a

s STARSLEFT

a: A set of HTML <img> tags with the stars aligned on the left.l

< STARSRIGHTm

o: A set of HTML <img> tags with the stars aligned on the right.

U STARTYEAR, STARTMONTH, STARTDAY,sN ENDYEAR, ENDMONTH, ENDDAY

; The currently specified date range for restricting searchi results.

m SYNTAXERROR

e5 Is the text of the boolean expression syntax error.e

 TITLE

1 The title of the document for the current matchI

 URL

a/ The URL to the document for the current matchp

. VERSION

 The ht://Dig version number 

V WORDS

r6 A string of the search words with spaces in between.


, Last modified: $Date: 2002/01/27 05:33:20 $ n/˙˙rong> 
C Expands to the named anchor found just before the first match; itE includes "#" at the start so it can be directly appended to the URL4 variable. If no anchor was found, ANCHOR is empty.