Drag and Drop CGI | 11
Using the ICE Scripts in Your Pages
By now you've done all the hard work. To use the script in your pages, you simply call the form script with a hyperlink like this:
<A HREF="cgi-bin/ice-form.cgi">Search this site</A>
The ice-form.cgi script generates both the search request form and the search results page. You can also use ``canned'' searches that don't present a search form. For example, to search for all recently changed documents, you could have a link such as
<A HREF="cgi-bin/ice-form.cgi?DAYS=7">What's new this week</A>
This Month's Game Reviews</A>
Take a look at the default search form using the View Source function of your browser. You'll be able to see the form element names and use them in your preset queries.
The ICE script presents the request form if it is called with no form data. If either GET or POST style form data is passed to the script, it parses the fields and uses the values for a search, presenting the results on the results page. The script can't tell if the form data came from an actual form or from a "canned" CGI call, as described previously.
As an alternative, you can create the search form with your favorite HTML editor and call the script with the ACTION= parameter of the <FORM> tag. The best way to do this is to capture the search form HTML generated by the script. Save the default form HTML to a file using the Save As function of your browser. Then you can edit the form HTML to match the look of your Web site. You can remove features you don't use from the form, such as the thesaurus check box, the older-than-X-days field, or the area to search select list. You must return the input field for the search words, but that's about all. You can, of course, change the prompting text and re-arrange the locations of the fields to suit your artistic sensibilities.
One limitation of the ICE system is that it doesn't give any context for the search results. That is, it just links you to a page. Your search term could be anywhere in a potentially very long document. This is often irritating when substring matching is used (when parts of longer words the user wasn't searching for are matched). The user may look through the page for a long time, only to discover the match was within some completely unrelated word.
At the time of this writing, we have a prototype modification to ICE that highlights the search words in the returned document, thus making them easy to pick out. Unfortunately, we didn't have time to test the modifications sufficiently to include them in this book (a good reason to buy the second edition, we think). Check the book's Web site (http://www.hypertising.com/DnDCGI/) periodically to see if we've finished this modification, as well as other enhancements to ICE.
Those of you who are happy with the default results page and who don't need a -thesaurus can safely stop here and move on to another script. Those who want to modify the output page or create a thesaurus file should continue reading.
Comments are welcome
Copyright © 1997 Addison-Wesley Pub Co. and
Created: Oct. 24, 1997
Revised: Oct. 27, 1997