Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Illegal characters showing up in search results

Quote Reply
Illegal characters showing up in search results
Using site_html.pl , I use the $term tag to show what users searched for. However if someone enters something like "Gossamer Threads" the space between the two words shows up as a "%", thus appears as "gossamer%threads".

How can I get rid of this?

Thanks in advance.
Quote Reply
Re: Illegal characters showing up in search results In reply to
$query should do it
Quote Reply
Re: Illegal characters showing up in search results In reply to
I tried the $query tag but nothing appears in its place. I even tried %query.
Quote Reply
Re: Illegal characters showing up in search results In reply to
i don't use the site_html.pl but i looked at it and couldn't you use this <%query%>. Give it a try.

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: Illegal characters showing up in search results In reply to
I tried the <%query%> suggestion, but it just prints the text "<%query%>". Hmmm, if anyone out there is reading this thread, could they please send me the tag that they use to print out the search terms?

Thankyou.
Quote Reply
Re: Illegal characters showing up in search results In reply to
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=&region=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.
Quote Reply
Re: Illegal characters showing up in search results In reply to
Bobsie, Aren't the tags different for templates though? For example templates use <%tag%> where as site_html uses $tag.

I currently use site_html.pl and when I use $term I get something like:

"keyword%20keyword%20keyword"

I have tried $query but it doesn't display anything. Is there instructions somewhere that list ALL the tags for site_html.pl?

Here is a list of what I have tried that didn't work:

$query , %query , $query$ , %query% , and a few others.
Quote Reply
Re: Illegal characters showing up in search results In reply to
Hi,

If you are using site_html.pl you should be able to use $in{'query'} to get what the user entered. (All of the submitted information is available in the global hash %in).

Cheers,

Alex