RE: htdig: Using Templates


Majeau, Benoit (Benoit.Majeau@nrc.ca)
Wed, 16 Dec 1998 09:58:32 -0500


Hi

You can customize everything or almost ;)

It is quite easy to do so. Go under your common directory.

There you should find a bunch of HTML files. The result page is using at
least 4 HTML pages (not at the same time !:-)):

1. The header of the results page (header.html)
2. The footer of the results page (footer.html)
3. The syntax error page (syntax.html)
4. The no match error page (nomatch.html)

Modify the content of those files to your needs according to some attributes
( look at http://www.htdig.org/attrs.html <http://www.htdig.org/attrs.html>
under search_results_header for instance). Then, to tell ht://Dig that you
want your search engine to use those files, you will have to add their paths
in your configuration file with the following lines (mainly if you are using
different file names, I usually don't use the originals):

search_results_header: ${common_dir}/myheader.html
        search_results_footer: ${common_dir}/myfooter.html
        nothing_found_file: ${common_dir}/mynomatch.html
        syntax_error_file: ${common_dir}/mysyntax.html

[Taken from the ht://Dig site]

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

[End]

But, you can build your own template simply by writing an HTML file using
the attributes on this page (http://www.htdig.org/hts_templates.html).

Then add your new template format in your configuration file like this:

Template_map: Short builtin-short builtin-short \
         Normal builtin-long builtin-long \
               Detailed detail ${common_dir}/detail.html (<-- example)

Use the template_name attribute to set the default template to use in the
results page.

...oh and don't forget to add the new format in your HTML search page and
voilą!

Hope I didn't miss anything :P

Benoit

        -----Original Message-----
        From: Vishal Shah [SMTP:vshah@bivwood.com]
        Sent: Tuesday, December 15, 1998 12:11 PM
        To: htdig@sdsu.edu
        Subject: htdig: Using Templates

        I am a beginner, trying to learn various ways of customizing htdig.

        How do I use customized templates to display the results ?

        
----------------------------------------------------------------------
        To unsubscribe from the htdig mailing list, send a message to
        htdig-request@sdsu.edu containing the single word "unsubscribe" in
        the body of the message.




This archive was generated by hypermail 2.0b3 on Sat Jan 02 1999 - 16:29:52 PST