Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

List Other Search Engines

Quote Reply
List Other Search Engines
I have noticed that some other Links 1.11 users list other search engines at the bottom of their search results pages. The query string is automatically inserted in the link to the various search engines. I understand how to do this, except for the automatic insertion of the query string in the HTML code. I thought that the following code would work, but it does NOT:

<!-- Other Search Engines Begins -->
<BR>
<P><CENTER><font face="arial, helvetica" size=2 color="#000000">Other Search Engines:<BR>
<a href="http://www.altavista.digital.com/cgi-bin/query?q=$query">Altavista</a>
| <a href="http://www.excite.com/search.gw?search=$query">Excite</A>
| <a href="http://www.hotbot.com/?SW=web&SM=SC&RG=NA&_v=2&DC=10&DE=2&MT=$query">Hotbot</A>
| <a href="http://www.infoseek.com/Titles?col=WW&sv=IS&lk=noframes&nh=10&qt=$query">Infoseek</A>
| <a href="http://www.looksmart.com/r_search?key=$query">Looksmart</A>
| <a href="http://www.lycos.com/cgi-bin/pursuit?cat=lycos&maxhits=10&query=$query">Lycos</A>
| <a href="http://search.yahoo.com/search?o=1&d=y&za=default&p=$query">Yahoo</A>
</FONT>
</CENTER>
<BR>
<!-- Other Search Engines Ends -->

I must be using the wrong string name. Can someone please tell me what I am doing wrong.

As always, I really appreciate your help!

Beau-
Quote Reply
Re: List Other Search Engines In reply to
Instead of $query, try $in{'query'} and see if that works.

------------------
Bob Connors
bobsie@orphanage.com
www.orphanage.com/goodstuff/
goodstufflists.home.ml.org/


Quote Reply
Re: List Other Search Engines In reply to
Hey, you're the man, Bob! That did the trick! Here's the corrected code that I inserted in the site_html.pl just before the site_footer, in case anyone else wants to stick in their links directory:

<!-- Other Search Engines Begins -->
<BR>
<P><CENTER><font face="arial, helvetica" size=2 color="#000000">Other Search Engines:<BR>
<a href="http://www.altavista.digital.com/cgi-bin/query?q=$in{'query'}
">Altavista</a>
| <a href="http://www.excite.com/search.gw?search=$in{'query'}
">Excite</A>
| <a href="http://www.hotbot.com/?SW=web&SM=SC&RG=NA&_v=2&DC=10&DE=2&MT=$in{'query'}
">Hotbot</A>
| <a href="http://www.infoseek.com/Titles?col=WW&sv=IS&lk=noframes&nh=10&qt=$in{'query'}
">Infoseek</A>
| <a href="http://www.looksmart.com/r_search?key=$in{'query'}
">Looksmart</A>
| <a href="http://www.lycos.com/cgi-bin/pursuit?cat=lycos&maxhits=10&query=$in{'query'}
">Lycos</A>
| <a href="http://search.yahoo.com/search?o=1&d=y&za=default&p=$in{'query'}
">Yahoo</A>
</FONT>
</CENTER>
<BR>
<!-- Other Search Engines Ends -->

Thanks again for the helping hand!

Beau
webmaster@RadioLinks.net
Quote Reply
Re: List Other Search Engines In reply to
Glad I could help but I can't take credit for it. It is just something I picked up (and remembered) elsewhere in these forums.


------------------
Bob Connors
bobsie@orphanage.com
www.orphanage.com/goodstuff/
goodstufflists.home.ml.org/


Quote Reply
Re: List Other Search Engines In reply to
You should use:

$query = &urlescape ($in{'query'});

and then use $query everywhere (put the above line just before you print out the text).

That way it still works if someone searches for 'Words with spaces'.

Cheers,

Alex
Quote Reply
Re: List Other Search Engines In reply to
Alex,

I did a global search for the word urlescape in both Links 1.1 and 2b4 and had no matches. Where is sub urlescape?

------------------
Bob Connors
bobsie@orphanage.com
www.orphanage.com/goodstuff/
goodstufflists.home.ml.org/


Quote Reply
Re: List Other Search Engines In reply to
Ooops, sorry that should be &urlencode, not &urlescape (in db.pl in 1.11 and db_utils.pl in 2.x).

Cheers,

Alex
Quote Reply
Re: List Other Search Engines In reply to
I don't understand exactly where I should insert

&urlescape ($in{'query'});

in the code for other search engines. Can you be a little more specific.

Thanks.
Quote Reply
Re: List Other Search Engines In reply to
Correction: I mean insert

&urlencode ($in{'query'});

in the code. Does it go everyplace that I currently have =$in{'query'} in the code above.

Thanks.
Quote Reply
Re: List Other Search Engines In reply to
Beau,

I use your code (somewhat modified) in the sub site_html_search_results and sub site_html_search_failure of site_html.pl. What I did in both routines is add the following right beneath "my (@hits) = @_;" and "my ($error) = $_[0];", respectively:

Code:
my $query = &urlencode ($in{'query'});

Then, in sub site_html_search_results, I did this:

Code:
<b>Your search for<br>
"<font color="#FF0000">$in{'query'}</font>"<br>
returned <font color="#FF0000">$cat_hits</font> Categories and <font color="#FF0000">$link_hits</font> Links.</b>

and beneath the search results, I put:

Code:
<form action="$build_search_url" 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="$in{'query'}"> 
<input type=submit value="Search!"><br>
<small class="more">
<a href="/cgi-bin/Links/search.cgi">Advanced Search</a>
</small>
<hr width="50%">
<!-- Other Search Engines Begins -->
<b>Try Your Search For<br>
"<font color="#FF0000">$in{'query'}</font>"<br>
Using One of These Search Engines:</b><br>
<small>
<a href="http://www.altavista.digital.com/cgi-bin/query?q=$query" target="jumpto">Altavista</a>
| <a href="http://www.excite.com/search.gw?search=$query" target="jumpto">Excite</a>
| <a href="http://www.hotbot.com/?SW=web&SM=SC&RG=NA&_v=2&DC=10&DE=2&MT=$query" target="jumpto">Hotbot</a>
| <a href="http://www.infoseek.com/Titles?col=WW&sv=IS&lk=noframes&nh=10&qt=$query" target="jumpto">Infoseek</a>
| <a href="http://www.looksmart.com/r_search?key=$query" target="jumpto">Looksmart</a>
| <a href="http://www.lycos.com/cgi-bin/pursuit?cat=lycos&maxhits=10&query=$query" target="jumpto">Lycos</a>
| <a href="http://search.yahoo.com/search?o=1&d=y&za=default&p=$query" target="jumpto">Yahoo</a>
</small>
</center>
<br>
<!-- Other Search Engines Ends -->
</td></tr></table>
</form>

In sub site_html_search_failure, I did this:

Code:
<b>Your search for<br>"<font color="#FF0000">$in{'query'}"</font><br>
resulted in:</b><br>
<font color=red><b>$error</b></font><br>
<form action="$build_search_url" 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="$in{'query'}"> 
<input type=submit value="Search!"><br>
<small class="more">
<a href="/cgi-bin/Links/search.cgi">Advanced Search</a>
</small>
<hr width="50%">
<!-- Other Search Engines Begins -->
<b>Try Your Search For<br>
"<font color="#FF0000">$in{'query'}</font>"<br>
Using One of These Search Engines:</b><br>
<small>
<a href="http://www.altavista.digital.com/cgi-bin/query?q=$query" target="jumpto">Altavista</a>
| <a href="http://www.excite.com/search.gw?search=$query" target="jumpto">Excite</a>
| <a href="http://www.hotbot.com/?SW=web&SM=SC&RG=NA&_v=2&DC=10&DE=2&MT=$query" target="jumpto">Hotbot</a>
| <a href="http://www.infoseek.com/Titles?col=WW&sv=IS&lk=noframes&nh=10&qt=$query" target="jumpto">Infoseek</a>
| <a href="http://www.looksmart.com/r_search?key=$query" target="jumpto">Looksmart</a>
| <a href="http://www.lycos.com/cgi-bin/pursuit?cat=lycos&maxhits=10&query=$query" target="jumpto">Lycos</a>
| <a href="http://search.yahoo.com/search?o=1&d=y&za=default&p=$query" target="jumpto">Yahoo</a>
</small>
</center>
<br>
<!-- Other Search Engines Ends -->
</td></tr></table>
</form>

As you can see, the only place I use $query is in the code you provided and I use $in{'query'} everywhere else.

I hope this helps.

------------------
Bob Connors
bobsie@orphanage.com
www.orphanage.com/goodstuff/
goodstufflists.home.ml.org/



[This message has been edited by Bobsie (edited January 15, 1999).]