Re: [htdig] Todo Ideas. Spam control, new search options and output

Gilles Detillieux (
Fri, 19 Feb 1999 17:02:39 -0600 (CST)

According to Alberto Olindo:
> > > -url dependant template
> > > I'd like to have different templates with certain urls, major
> > > sponsors, free services categories from our local directory
> > > etc.etc. right know yuo can modify only the stars image ...
> >
> > You can easily set up templates for each site and pick the template in the
> > search form (using either a config file or the allow_in_form attribute set
> > to template_name). You can basically set anything on the templates
> > themselves.
> > For examples, check out or my site's search at
> >
> Sorry, I didn't explain myself. This was not about template building.
> I'ts about template choosing and MIXING in the same output.
> We are also building a directory. We would like to give reviews of products
> or services from each site in the directory etc. etc.
> When it come to the search engine I'd like to modify the appeareance of
> particular urls. If, say, the third url spanned from the search is in the
> directory and has a good rating for products, I would have it in the
> htdig.config
> in a line like: (as with star_patterns)
> template_patterns: templates/good_prodocts.html
> \
> Etc. etc.
> The first 2 urls would appear with standard template and the third site in
> the list would be different....
> I would also use this to give URLs from our site a totally different look
> from other site's pages.

This sounds like a fairly simple addition to htsearch/
(and htsearch/Display.h). You'd want to add a new function,
Display::setupTemplates(), that would be almost identical to
setupImages(), and would set the new URLtemplate and URLtemplateList
variables from the strings in "template_patterns". It would be
called from Diplay::Display(), around where setupImages() is called.
Then, at the bottom of Display::displayMatch(), replace the call to
expandVariables() with something like this:

    int index = 0;
    int length = 0;
    int status = URLtemplate.FindFirst(ref->DocURL(), index, length);
    if (status >= 0 && index >= 0)
        displayParsedFile( ((String*) URLtemplateList[index])->get() );

I haven't actually tried it, but that should do the job. The
displayParsedFile() function should be adequate for handling the
templates, as each template is just a single file for the match
template. There's no start or end templates involved, so you shouldn't
need to use any of the code for handling it.

Gilles R. Detillieux              E-mail: <>
Spinal Cord Research Centre       WWW:
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 containing the single word "unsubscribe" in
the SUBJECT of the message.

This archive was generated by hypermail 2.0b3 on Mon Feb 22 1999 - 07:08:23 PST