Newscan Search Gadget
Make your site easier to navigate with the Newscan Search Gadget



[
Back to the Gadget List ]

A Flexible Search Tool

This gadget can be used for a variety of purposes, however, the most common use would be to create a searchable index of your web site. With that in mind, this tutorial will describe the steps for doing just that.

Example:

This example searches a small list of keywords and URLs. Our sample list is very small, so try searching for something we know is in the file like 'help' or 'storage'.

Search for:

The raw HTML:

<form action=/cgi-bin/newscan> 
Search for: <input name=key value=e> 
<input type=hidden name=file value=help/gadgets/newscan> 
<input type=hidden name=template value=help/gadgets/newscan> 
<input type=submit value=Search></form> 
Here are links to the data, header, template, and footer files.

The Data file and the TEMPLATE

Building your template is the key to working this gadget. The gadget simply searches through your (TAB delimited data) file and pulls out any lines (records) that match. It then uses the tabs within the line to separate it into fields.

Let's look at the example data file. The line containing the link to the online help actually contains "help" followed by a TAB character followed by "http://www.comevisit.com/help" (and ended with a new-line, or carriage-return and new-line). It looks like this:

help	http://www.comevisit.com/help
As we said, the gadget breaks this up into fields. In this case it breaks it up into two fields, one containing "help" and the other "http://www.comevisit.com/help".

In the template we refer to the fields by their position number. The first field is {0}, and the second field is {1} (if there were more the numbering would just continue {2}, {3} ...).

The first template looks like this:

Name: {0} <br>
Site: <A HREF="{1}">{1} </a><hr>
So the matching line comes out like:

Name: help <br>
Site: <A HREF="http://www.comeilding your template is the key to working this gadget. The gadget
simply searches through your (TAB delimited data) file and pulls out 
any lines (records) that match. It then uses the tabs within the line 
to separate it into fields. 

Let's look at the example data file. The line containing the link to the online help actually contains "help" followed by a TAB character followed by "http://www.comevisit.com/help" (and ended with a new-line, or carriage-return and new-line). It looks like this:

help	http://www.comevisit.com/help
As we said, the gadget breaks this up into fields. In this case it breaks it up into two fields, one containing "help" and the other "http://www.comevisit.com/help".

In the template we refer to the fields by their position number. The first field is {0}, and the second field is {1} (if there were more the numbering would just continue {2}, {3} ...).

The first template looks like this:

Name: {0} <br>
Site: <A HREF="{1}">{1} </a><hr>
So the matching line comes out like:

Name: help <br>
Site: <A HREF="http://www.comevisit.com/help">http://www.comevisit.com/help </a><hr>

Fine Points...

A maximum hit count has been implemented. It defaults to 100. Ask support@comevisit.com for instructions on how to change it. [It isn't posted here to stop people from writing their own forms and stealing your whole database!]

The gadget is by default NOT case-sensitive. To turn on case sensitivity, add <input type="hidden" name="f_case" value="Y" > to your form.

[ Back to the Gadget List ]


Copyright © 1996, ComeVisit.com
Last Updated: Tuesday, 20-Jan-1998 01:02:48 PST
Questions/Comments support@comevisit.com
Access Count: 21990