Re: [htdig] I don't want to show URLs


Subject: Re: [htdig] I don't want to show URLs
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Thu Nov 02 2000 - 10:15:08 PST


According to Peter Peltonen:
> Gilles Detillieux wrote:
> > You can actally just uncomment the template_map definition in your
> > /etc/htdig/htdig.conf, and then edit the /var/lib/htdig/common/long.html
> > result template. I have to wonder how you got your results to go into
>
> I edited /var/lib/htdig/common/long.html and made it look like this:
>
> --snip--
> <dl><dt><strong><a href="$&(URL)">$&(TITLE)</a></strong>$(STARSLEFT)
> </dt><dd>$(EXCERPT)<br>
>
> <!-- don't show url
>
> <i><a href="$&(URL)">$&(URL)</a></i>
>
> //-->
>
> <font size="-1">$(MODIFIED), $(SIZE) bytes</font>
> </dd></dl>
> --snip--
>
>
> But that didn't help at all -- my page still looks the same, the URL is
> shown.
>
> In my config file reads:
>
> --snip--
> # template_map: Long long ${common_dir}/long.html \
> # Short short ${common_dir}/short.html
> # template_name: long
>
> search_results_header: /var/lib/htdig/common/talenco.dev/header.shtml
> search_results_footer: /var/lib/htdig/common/talenco.dev/footer.html
> nothing_found_file: /var/lib/htdig/common/talenco.dev/nomatch.html
> --snip--

Yes, this is the problem! You must remove the "# " from the start of
the 3 lines above that define template_map and template_name, otherwise
it will only use the builtin result templates and ignore the external
one you just edited.

> > table form without doing just that, unless you merely put the table
> > definitions in the header.html and footer.html and let all the results
> > go into a single cell of the table.
>
> That's what I've done, yes. Was that an incorrect way of doing things?

No, not necessarily. It's just when I read that your results were in
a table, I immediately had it in my mind that you defined each result
as a separate table row, which would have required editing the result
template, so it seemed odd that you didn't see how to remove the URL
from that same result template.

> The templates thing is a bit confusing for me... I read the documentation
> from the web page but didn't quite understand what they are (are the header
> and footer files part of the template or not? why use a bunch of small html
> files instead of one big html file with the template attributes?).

Yes, the header and footer files are templates, as are the nomatch file
and the syntax error file. The header and footer templates can now also
be combined into a single wrapper file if desired. The result templates
differ from these other templates in 3 ways:

1) the result template is applied repeatedly for each search result,
rather than just once as for the other templates,

2) the result template can be user-selected via the "format" input
parameter, which overrides the template_name attribute, and selects one
of several possible choices in the template_map,

3) you have your choice between compiled-in templates (builtin-long,
builtin-short) or external template files for results, while the other
templates must be in external files only.

For reasons (1) and (2) above, the result templates must be in separate
files from the wrapper or header and footer.

> And what is the template map? This looks a bit cryptic for me:
>
> --snip--
> template_map:
> Short short ${common_dir}/short.html \
> Normal normal builtin-long \
> Detailed detail ${common_dir}/detail.html
> --snip--
>
> It's all probably very easy and my brain just isn't working right :)

The template_map is a bit more complicated than the attributes for
selecting the other template files, because it essentially defines a
menu of choices which can be picked from the search form. The first
field is the name the user sees in the form, the second is the one used
internally for the format parameter value, and the third is the file
name or compiled-in name.

See the following for more information:
http://www.htdig.org/FAQ.html#q4.2
http://www.htdig.org/attrs.html#template_map
http://www.htdig.org/hts_form.html
http://www.htdig.org/hts_templates.html
http://www.htdig.org/hts_selectors.html

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig-unsubscribe@htdig.org You will receive a message to confirm this. List archives: <http://www.htdig.org/mail/menu.html> FAQ: <http://www.htdig.org/FAQ.html>



This archive was generated by hypermail 2b28 : Thu Nov 02 2000 - 10:21:59 PST