Debian Codegraph @

htdoc/hts_templates.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2 <html>
3 <head>
4 <title>
5 ht://Dig: htsearch
6 </title>
7 </head>
8 <body bgcolor="#eef7ff">
9 <h1>
10 htsearch
11 </h1>
12 <p>
13 ht://Dig Copyright &copy; 1995-2004 <a href="THANKS.html">The ht://Dig Group</a><br>
14 Please see the file <a href="COPYING">COPYING</a> for
15 license information.
16 </p>
17 <hr size="4" noshade>
18 <h2>
19 Output Templates
20 </h2>
21 <p>
22 The htsearch program will normally produce HTML output. In this
23 process it makes extensive use of template in which variables
24 will be substituted. The templates are specified in the
25 configuration file. The configuration file attributes defining
26 these templates are:
27 </p>
28 <ul>
29 <li>
30 <a href="attrs.html#search_results_header">
31 search_results_header</a>
32 </li>
33 <li>
34 <a href="attrs.html#search_results_footer">
35 search_results_footer</a>
36 </li>
37 <li>
38 <a href="attrs.html#search_results_wrapper">
39 search_results_wrapper</a>
40 </li>
41 <li>
42 <a href="attrs.html#nothing_found_file">
43 nothing_found_file</a>
44 </li>
45 <li>
46 <a href="attrs.html#syntax_error_file">
47 syntax_error_file</a>
48 </li>
49 </ul>
50 <p>
51 In addition to these files, the search results are also
52 produced with the use of templates. The result templates are
53 a bit more complicated because they can be specified at
54 runtime using an HTML menu. They are specified using the <a
55 href="attrs.html#template_map">template_map</a> configuration
56 file attribute. This attribute contains a list of strings
57 triplets. For each triplet of strings, the elements have the
58 following meaning:
59 </p>
60 <ol>
61 <li>
62 the name that will appear in the FORMAT menu (see below)
63 </li>
64 <li>
65 the internal name used by htsearch for this result template
66 </li>
67 <li>
68 the base filename for the template.
69 </li>
70 </ol>
71 <p>
72 There are two predefined templates that are used by default.
73 They have the internal names <em>builtin-long</em> and <em>
74 builtin-short</em>. As such, the default value for the <em>
75 template_map</em> attribute is as follows:
76 </p>
77 <blockquote>
78 Long builtin-long builtin-long \<br>
79 Short builtin-short builtin-short
80 </blockquote>
81 <p>
82 Which means that there will be two ways to display the search
83 results: a "Long" and a "Short" way. The first template listed
84 will always be the default one for the first search.
85 Thereafter, the default will be whatever was selected for the
86 previous search.
87 </p>
88 <h4>
89 Result template files
90 </h4>
91 <p>
92 When a custom template is required, one or more template files
93 need to be created and referenced in the <em>template_map</em>
94 attribute. These templates are user-selectable from the search
95 form. It is also possible to select result templates based on
96 URL patterns of the search matches, using the
97 <em>template_patterns</em> attribute. This allows distinct visual
98 styles to be used for matches on different web sites.
99 </p>
100 <p>
101 There are many variables that can be substituted into these
102 templates. Not all of them make sense for each file, so not
103 all of them will be substituted for every file, as noted below.
104 <!-- Should explain "matchTemplate" more explicitly... How? -->
105 In addition, all
106 of the standard CGI environment variables are available, and
107 listed in the <a href="http://hoohoo.ncsa.uiuc.edu/cgi/">cgi
108 specification</a>. Variables will be substituted normally
109 with the format $(VAR), escaped for use in a URL with the
110 format $%(VAR), URL-encoding decoded with the format $=(VAR),
111 and HTML-escaped with the format $&amp;(VAR). The variables are:
112 </p>
113 <dl>
114 <dt>
115 <strong>ANCHOR</strong>
116 (Only in matchTemplate)
117 </dt>
118 <dd>
119 Expands to the named anchor found just before the first match; it
120 includes "#" at the start so it can be directly appended to the URL
121 variable. If no anchor was found, ANCHOR is empty.
122 </dd>
123 <dt>
124 <strong>BACKLINKS</strong>
125 (Only in matchTemplate)
126 </dt>
127 <dd>
128 The number of links <strong>to</strong> the current match.
129 </dd>
130 <dt>
131 <strong><a name="CGI">CGI</a></strong>
132 </dt>
133 <dd>
134 Unless the configuration file sets a different value,
135 this expands to whatever the SCRIPT_NAME environment
136 variable is. See the
137 <a href="attrs.html#script_name">script_name</a>
138 configuration file attribute for more information.
139 </dd>
140 <dt>
141 <strong>CONFIG</strong>
142 </dt>
143 <dd>
144 The <a href="hts_form.html#config">configuration file</a>.
145 </dd>
146 <dt>
147 <strong>CURRENT</strong>
148 (Only in matchTemplate)
149 </dt>
150 <dd>
151 The number of the current match.
152 </dd>
153 <dt>
154 <strong><a name="DESCRIPTION">DESCRIPTION</a></strong>
155 (Only in matchTemplate)
156 </dt>
157 <dd>
158 The first URL description for the matched document. See below.
159 </dd>
160 <dt>
161 <strong><a name="DESCRIPTIONS">DESCRIPTIONS</a></strong>
162 (Only in matchTemplate)
163 </dt>
164 <dd>
165 A list of <a href="attrs.html#description_factor">URL text
166 descriptions</a> for the matched document. The
167 entries in the list are separated by &lt;br&gt;. These are the
168 text used between the &lt;a href...&gt; and &lt;/a&gt;tags.
169 These are controlled by the
170 <a href="attrs.html#max_descriptions">max_descriptions</a> and
171 <a href="attrs.html#max_description_length">max_description_length</a>
172 configuration attributes.
173 </dd>
174 <dt>
175 <strong>DOCID</strong>
176 (Only in matchTemplate)
177 </dt>
178 <dd>
179 The internal ID for the document for the current match.
180 </dd>
181 <dt>
182 <strong>EXCERPT</strong>
183 (Only in matchTemplate)
184 </dt>
185 <dd>
186 The relevant <a href="attrs.html#excerpt_show_top">excerpt</a>
187 for the current match.
188 </dd>
189 <dt>
190 <strong>EXCLUDE</strong>
191 </dt>
192 <dd>
193 A <a href="hts_form.html#exclude">list of words excluded</a>
194 from the search, separated by '|'.
195 </dd>
196 <dt>
197 <strong>FIRSTDISPLAYED</strong>
198 </dt>
199 <dd>
200 The index of the first match on this page.
201 </dd>
202 <dt>
203 <strong>FORMAT</strong>
204 </dt>
205 <dd>
206 Expands to an HTML menu of all the available formats. The
207 current format will be the default one.
208 The menu is composed of choices itemized in the
209 <a href="attrs.html#template_map">template_map</a>
210 attribute. The expansion of this template variable is
211 described in more detail in the
212 <a href="hts_selectors.html">select list documentation</a>.
213 </dd>
214 <dt>
215 <strong>HOPCOUNT</strong>
216 (Only in matchTemplate)
217 </dt>
218 <dd>
219 The distance of this match away from the starting
220 document(s).
221 </dd>
222 <dt>
223 <strong>KEYWORDS</strong>
224 </dt>
225 <dd>
226 A string of the search keywords with spaces in between, as
227 specified in the
228 <a href="hts_form.html#keywords"><em>keywords</em> input
229 parameter</a>.
230 </dd>
231 <dt>
232 <strong>LASTDISPLAYED</strong>
233 </dt>
234 <dd>
235 The index of the last match on this page.
236 </dd>
237 <dt>
238 <strong><a name="LOGICAL_WORDS">LOGICAL_WORDS</a></strong>
239 </dt>
240 <dd>
241 A string of the <a href="hts_form.html#words">search words</a>
242 with "and", "or" or "not" between the words, depending on the
243 <a href="hts_form.html#match_method">type of search</a>.
244 (These values are overridden by the
245 <a href="attrs.html#boolean_keywords">boolean_keywords</a>
246 attribute.)
247 </dd>
248 <dt>
249 <strong>MATCH_MESSAGE</strong>
250 </dt>
251 <dd>
252 This is either <code>all</code> or <code>any</code> depending on
253 the <a href="hts_form.html#match_method">match method</a> used.
254 (These values are overridden by the
255 <a href="attrs.html#method_names">method_names</a>
256 attribute.)
257 </dd>
258 <dt>
259 <strong>MATCHES</strong>
260 </dt>
261 <dd>
262 The total number of matches that were found.
263 </dd>
264 <dt>
265 <strong><a name="MATCHES_PER_PAGE">MATCHES_PER_PAGE</a></strong>
266 </dt>
267 <dd>
268 The configured <a href="hts_form.html#matchesperpage">maximum
269 number of matches</a> on this page.
270 </dd>
271 <dt>
272 <strong>MAX_STARS</strong>
273 </dt>
274 <dd>
275 The configured <a href="attrs.html#max_stars">maximum number
276 of stars</a> to display in matches.
277 </dd>
278 <dt>
279 <strong><a name="METADESCRIPTION">METADESCRIPTION</a></strong>
280 (Only in matchTemplate)
281 </dt>
282 <dd>
283 The meta description text (if any) for the matched document.
284 </dd>
285 <dt>
286 <strong>METHOD</strong>
287 </dt>
288 <dd>
289 Expands to an HTML menu of all the available matching
290 methods. The current method will be the default one.
291 The menu is composed of choices itemized in the
292 <a href="attrs.html#method_names">method_names</a>
293 attribute. The expansion of this template variable is
294 described in more detail in the
295 <a href="hts_selectors.html">select list documentation</a>.
296 </dd>
297 <dt>
298 <strong>MODIFIED</strong>
299 (Only in matchTemplate)
300 </dt>
301 <dd>
302 The date and time the document was last modified
303 </dd>
304 <dt>
305 <strong>NEXTPAGE</strong>
306 </dt>
307 <dd>
308 This expands to the value of the
309 <a href="attrs.html#next_page_text">next_page_text</a> or
310 <a href="attrs.html#no_next_page_text">no_next_page_text</a>
311 attributes depending on whether there is a next page or not.
312 If there is only one page of output, this is empty, regardless
313 of the setting of no_next_page_text.
314 </dd>
315 <dt>
316 <strong>NSTARS</strong>
317 </dt>
318 <dd>
319 The number of stars calculated for this document as an
320 integer, up to a maximum specified by the <a
321 href="attrs.html#max_stars">max_stars</a> attribute.
322 </dd>
323 <dt>
324 <strong>PAGE</strong>
325 </dt>
326 <dd>
327 The current page number. Equal to the
328 <a href="hts_form.html#page">page</a> CGI argument, or 1 by
329 default.
330 </dd>
331 <dt>
332 <strong>PAGEHEADER</strong>
333 </dt>
334 <dd>
335 This expands to either the value of the
336 <a href="attrs.html#page_list_header">page_list_header</a> or
337 <a href="attrs.html#no_page_list_header">no_page_list_header</a>
338 attributes depending on how many pages there are.
339 </dd>
340 <dt>
341 <strong>PAGELIST</strong>
342 </dt>
343 <dd>
344 This expands to a list of hyperlinks using the
345 <a href="attrs.html#page_number_text">page_number_text</a> and
346 <a href="attrs.html#no_page_number_text">no_page_number_text</a>
347 attributes. For the current page, it displays
348 no_page_number_text without a hyperlink. Other pages have a
349 hyperlink, and use page_number_text.
350 </dd>
351 <dt>
352 <strong>PAGES</strong>
353 </dt>
354 <dd>
355 The total number of pages.
356 </dd>
357 <dt>
358 <strong>PERCENT</strong>
359 (Only in matchTemplate)
360 </dt>
361 <dd>
362 The match score as a percentage. Its range is 1 to 100,
363 without a percent sign. The minimum is always 1 so the
364 variable can be used as the value for an HTML WIDTH
365 attribute.
366 </dd>
367 <dt>
368 <strong>PLURAL_MATCHES</strong>
369 </dt>
370 <dd>
371 If the <strong>MATCHES</strong> variable is other than 1, this
372 will be a single 's'.
373 (This value is overridden by the
374 <a href="attrs.html#plural_suffix">plural_suffix</a>
375 attribute.)
376 </dd>
377 <dt>
378 <strong>PREVPAGE</strong>
379 </dt>
380 <dd>
381 This expands to the value of the
382 <a href="attrs.html#prev_page_text">prev_page_text</a> or
383 <a href="attrs.html#no_prev_page_text">no_prev_page_text</a>
384 attributes depending on whether there is a previous page or not.
385 If there is only one page of output, this is empty, regardless
386 of the setting of no_prev_page_text.
387 </dd>
388 <dt>
389 <strong>RESTRICT</strong>
390 </dt>
391 <dd>
392 The <a href="hts_form.html#restrict">list of patterns</a> which
393 must be matched by the returned URLs, separated by '|'.
394 </dd>
395 <dt>
396 <strong>SCORE</strong>
397 (Only in matchTemplate)
398 </dt>
399 <dd>
400 The score of the current match
401 </dd>
402 <dt>
403 <strong><a name="SELECTED_FORMAT">SELECTED_FORMAT</a></strong>
404 </dt>
405 <dd>
406 The currently selected <a href="hts_form.html#format">format</a>.
407 </dd>
408 <dt>
409 <strong><a name="SELECTED_METHOD">SELECTED_METHOD</a></strong>
410 </dt>
411 <dd>
412 The currently selected <a href="hts_form.html#method">matching
413 method</a>.
414 </dd>
415 <dt>
416 <strong><a name="SELECTED_SORT">SELECTED_SORT</a></strong>
417 </dt>
418 <dd>
419 The currently selected <a href="hts_form.html#sort">sorting
420 method</a>.
421 </dd>
422 <dt>
423 <strong>SIZE</strong>
424 (Only in matchTemplate)
425 </dt>
426 <dd>
427 The size of the document for the current match
428 </dd>
429 <dt>
430 <strong>SIZEK</strong>
431 (Only in matchTemplate)
432 </dt>
433 <dd>
434 The size in kilobytes of the document for the current match
435 </dd>
436 <dt>
437 <strong>SORT</strong>
438 </dt>
439 <dd>
440 Expands to an HTML menu of all the available sorting
441 methods. The current method will be the default one.
442 The menu is composed of choices itemized in the
443 <a href="attrs.html#sort_names">sort_names</a>
444 attribute. The expansion of this template variable is
445 described in more detail in the
446 <a href="hts_selectors.html">select list documentation</a>.
447 </dd>
448 <dt>
449 <strong>STARSLEFT</strong>
450 (Only in matchTemplate)
451 </dt>
452 <dd>
453 A set of HTML &lt;img&gt; tags with the
454 <a href="attrs.html#star_image">stars</a> aligned on the left.
455 </dd>
456 <dt>
457 <strong>STARSRIGHT</strong>
458 (Only in matchTemplate)
459 </dt>
460 <dd>
461 A set of HTML &lt;img&gt; tags with the stars
462 <a href="attrs.html#star_image">stars</a> aligned on the right.
463 </dd>
464 <dt>
465 <strong>STARTYEAR</strong>, <strong>STARTMONTH</strong>, <strong>STARTDAY</strong>,
466 <strong>ENDYEAR</strong>, <strong>ENDMONTH</strong>, <strong>ENDDAY</strong>
467 </dt>
468 <dd>
469 The currently specified <a href="hts_form.html#startyear">date
470 range</a> for restricting search results.
471 </dd>
472 <dt>
473 <strong>SYNTAXERROR</strong>
474 (Only in
475 <a href="attrs.html#syntax_error_file">syntax_error_file</a>)
476 </dt>
477 <dd>
478 Is the text of the boolean expression syntax error.
479 </dd>
480 <dt>
481 <strong>TITLE</strong>
482 (Only in matchTemplate)
483 </dt>
484 <dd>
485 The title of the document for the current match
486 </dd>
487 <dt>
488 <strong>URL</strong>
489 (Only in matchTemplate)
490 </dt>
491 <dd>
492 The URL to the document for the current match
493 </dd>
494 <dt>
495 <strong>VERSION</strong>
496 </dt>
497 <dd>
498 The ht://Dig <a href="attrs.html#version">version number</a>.
499 </dd>
500 <dt>
501 <strong>WORDS</strong>
502 </dt>
503 <dd>
504 A string of the <a href="hts_form.html#words">search words</a>
505 with spaces in between.
506 </dd>
507 </dl>
508 <hr size="4" noshade>
509
510 Last modified: $Date: 2004/05/28 13:15:18 $
511
512 </body>
513 </html>