Here's my code from site_html_templates.pl:
Code:
sub site_html_search_results {
# --------------------------------------------------------
# This routine displays the search results.
#
my $term = &urlencode ($in{'query'});
my $CatNbr = 7;
&html_print_headers;
print &load_template (
'search_results.html', {
catnbr => $CatNbr,
term => $term,
link_results => $link_results,
category_results => $category_results,
next => $next,
cat_hits => $cat_hits,
link_hits => $link_hits,
%in,
%globals
}
);
}
Here's how I display the results in search_results.html:
Quote:
<table border=1 bgcolor="#FFFFEC" cellpadding=10 width="90%">
<tr><td align="center" valign="top">
<font size="5" color="#FF0000"><b>Bob's Good Stuff Lists<br>Search Results</b></font>
<p>
<b>Your search for<br>
"<font color="#FF0000"><%query%></font>"<br>
returned <font color="#FF0000"><%cat_hits%></font> Categories and <font color="#FF0000"><%link_hits%></font> Links.</b>
<%if next%>
</td></tr><tr><td align="center" valign="top">
<font color="#FF0000"><b><u>Search Result Pages</u></b></font>
<p>
<%next%>
<%endif%>
<%if category_results%>
</td></tr><tr><td>
<center><font face="arial, helvetica" size="3" color="#FF0000"><strong><u>Categories</u></strong></font></center>
<p>
<font size="3" color="#000000"><%category_results%></font>
<%endif%>
<%if link_results%>
</td></tr><tr><td>
<center><font face="arial, helvetica" size="3" color="#FF0000"><strong><u>Links</u></strong></font></center>
<p>
<font size="3" color="#000000"><%link_results%></font>
<%endif%>
<%if next%>
</td></tr><tr><td align="center" valign="top">
<font color="#FF0000"><b><u>Search Result Pages</u></b></font>
<p>
<%next%>
<%endif%>
</td></tr><tr><td align="center" valign="top">
<form action="<%db_cgi_url%>/search.cgi" method="GET">
<table cellpadding=10 align="center" valign="top" border=1 bgcolor="#D5E8E8">
<tr><td align="center" valign="top">
<b>Search again?</b><br>
<input type="text" size=30 name="query" value="<%query%>">
<input type=submit value="Search!"><br>
<small>
<a href="<%db_cgi_url%>/search.cgi">Advanced Search</a>
</small>
<hr width="50%">
<!-- Other Search Engines Begins -->
<b>Or Try Your Search For<br>
"<font color="#FF0000"><%query%></font>"<br>
Using One of These Search Engines:</b><br>
<small>
<a href="http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&q=<%term%>" target="jumpto">Altavista</a>
| <a target="jumpto" href=http://www.amazon.com/exec/obidos/external-search?mode=books&keyword=<%term%>&tag=bobsgoodstufflis">Amazon.com</a>
| <a target="jumpto" href="http://www.dejanews.com/dnquery.xp?QRY=<%term%>">Deja News</a>
| <a href="http://www.excite.com/search.gw?search=<%term%>" target="jumpto">Excite</a>
| <a href="http://www.hotbot.com/?SW=web&SM=SC&RG=NA&_v=2&DC=10&DE=2&MT=<%term%>" target="jumpto">Hotbot</a>
| <a href="http://www.infoseek.com/Titles?col=WW&sv=IS&lk=noframes&nh=10&qt=<%term%>" target="jumpto">Infoseek</a>
| <a href="http://www.looksmart.com/r_search?key=<%term%>" target="jumpto">Looksmart</a>
| <a href="http://www.lycos.com/cgi-bin/pursuit?cat=lycos&maxhits=20&query=<%term%>" target="jumpto">Lycos</a>
| <a href="http://search.go2net.com/crawler?general=<%term%>&method=0&target=®ion=0&rpp=20&timeout=5&hpe=10" target="jumpto">MetaCrawler</a>
| <a href="http://search.yahoo.com/search?o=1&d=y&za=default&p=<%term%>" target="jumpto">Yahoo</a>
</small>
<!-- Other Search Engines Ends -->
</td></tr></table>
</form>
</td></tr></table>
I hope this helps.