Gossamer Forum
Home : Products : Links 2.0 : Customization :

Help removing the % symbol from outputs...???

Quote Reply
Help removing the % symbol from outputs...???
Would anyone know how to remove the % symbol from the $term output? Whenever someone does a search, my Amazon Code outputs the search words with the % symbol for spaces. Like:

amazon%books%for%sale

Anyone know how I can remove this? I am using 2.0, not using templates. Thx!
Quote Reply
Re: Help removing the % symbol from outputs...??? In reply to
$term =~ s/%/ /g; #replaces all % with a space

--mark
Quote Reply
Re: Help removing the % symbol from outputs...??? In reply to
Or use $in{'query'} instead of $term.
Quote Reply
Re: Help removing the % symbol from outputs...??? In reply to
$term =~ s/%/ /g; #replaces all % with a space


Or use $in{'query'} instead of $term.

where do you make thes changes? CGI or html files. Please give example and the file I have to change

thanks
Evan
Quote Reply
Re: Help removing the % symbol from outputs...??? In reply to
Bobbie...

Here's the problem...
You cant have spaces in the URL, so the %20 is being seen as a space, is there a way to add a variable say <%split-term%> and have it do this?

<%term%> = baseball%20yankees
<%split-term%> = baseball+yankees

?
Quote Reply
Re: Help removing the % symbol from outputs...??? In reply to
The $term varialble will contain the query with %20 in it. $in{'query'} will contain the same query but with spaces instead of the %20, so there is no need to do any conversion. I use $term (<%term%> in templates) when searching external search engines. But when displaying the terms to the user in my HTML pages, I use $in{'query'} (<%query%> in templates). For example, here's the code I use 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_subtitle%><strong><u>Categories</u></strong></font></center>
<p>
<%font_category%><%category_results%></font>
<%endif%>
<%if link_results%>
</td></tr><tr><td>
<center><%font_subtitle%><strong><u>Links</u></strong></font></center>
<p>
<%font_link%><%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: Help removing the % symbol from outputs...??? In reply to
Thanks Bobbie!
I just needed to know what where to use it...

Now I get it Smile

thanks again!!

i am using it now, and it makes things look MUCH better Wink
Babalon
http://thelema.dynip.com/
A Center of Pestilence