When it comes to usability and information architecture, there is just no replacement for a good search engine on your site. Try as you might to design an intuitive navigation scheme, let’s face it…one size never fits all. But no need to fear…your search engine can add an alternative way for folks to find what they so desparately seek.
In my world (UT Austin), I’ve got two obvious choices for search engines, Google Free University Search and htdig. While Google is sweet, I can’t customize the results page, so google doesn’t meet my needs. So, I turn to my good ole friend, htdig. But unlike other sites where I’ve implemented htdig, the site I’m working with now stretches across two different servers and is virtually hosted as well. Creating the results page header and footer proved to be a challenge because (horrors), htdig wouldn’t let me use server side includes (ssi) . Ouch!
I toyed with the idea of writing the results page in PHP but was convinced that if I thought creatively enough, I could trick htdig into letting me use ssi. And after a few bumps and bruises I won the battle. So, in case you’ve got a yearnin’ for ssi in your htdig results page, here is what I learned yesterday.
Ingredients:
- plain ole html search form using get with the action set to a dynamic results page
- dynamic results page with a suffix of .html
- .htacess file instructing your server to parse .html for ssi
- and your usual header.html and footer.html
1) Set your search form vars as follows:
<form method="get" action="results.html">
<input type="hidden" name="config" value="nameofyourconf" />
<input type="hidden" name="restrict" value="" />
<input type="hidden" name="exclude" value="" />
<label for="words" class="headline">Search XYZ site:
<input type="text" size="30" name="words" id="words" value="" />
<input type="submit" value="Search" />
</form>
Note: the method is get and the action is pointing to your dynamic html results page.
2) dynamic results page – use
<!--#include virtual="foo.html"-->
to dynamically bring in elements
3) create an .htaccess file that includes:
AddType text/html .html
AddHandler server-parsed .html
4) Create your htdig custom header.html and footer.html and set your conf (htdig config) to use these files. Just remember that you can not use ssi in these two files because htdig won’t process it…and htdig currently requires that these files be html files. No shtml or php versions of the header or footer allowed!
And for your coding pleasure, a working sample.