My Account
Domain Registration Management Services
Web Services
Rates and Specs
Bulk Rates
CGI Library
Order Form
Tech Support
Billing Info
Company Info
Legal Info
Privacy Statement


Web Services


Return CGI Library

A More Flexible Search Tool

This gadget provides a more flexible tool to handle TAB delimited databases than the "find" gadget. It uses a template similar to those of the mail2 gadget, and separate files to hold a page header and a page footer.


These example use a similar database to the find example... a table of web-sites. The sample table is very small, so consider searching on something simple like 'e'. The difference between the two searches is the template that they use. The first produces text output and the second produces a table as output.

Search for:
Search for:

The raw HTML:

<form action="/cgi-bin/newscan" method="post" >
Search for: <input type="text" name="key" value="e" />
<input type="hidden" name="file" value="/gadgets/newscan/newscan" />
<input type="hidden" name="template" value="/gadgets/newscan/newscan" />
<input type="submit" value=Search></form>

And the second example changes only the template value:

<input type="hidden" name="template" value="/gadgets/newscan/table" />

Here are links to the data, header, template, and footer files.
(And the same for the table version: 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, and pick on Sun Micro-systems. The line containing sun actually contains "sun" followed by a TAB character followed by "" (and ended with a new-line, or carriage-return and new-line). It looks like this:


As we said, the gadget breaks this up into fields. In this case it breaks it up into two fields, one containing "sun" and the other "".

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}">{0}</a>

So the matching line comes out like:

Name: sun <br />
Site: <a href="">sun</a>

Fine Points...

A maximum hit count HAS been implemented. It defaults to 100. Ask 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.

This gadget includes our referer security check.

Home Page    Domain Registration Services    Web Services    Technical Support
About Baremetal    Privacy Statement    Billing Info    Charities
My Account    Legal Info    Search BareMetal

Copyright 1996-2012, Inc.
Last updated: Thursday, 28-May-2015 16:14:53 PDT
Last Accessed from:
Questions and comments to