Welcome to WebmasterWorld Guest from 23.20.79.227

Forum Moderators: mack

Message Too Old, No Replies

Searching with links

Searching a website with a text link

     
4:29 pm on Feb 10, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 10, 2010
posts:4
votes: 0


Hello all,

I'm not really sure where to post this question, but because I'm a newbie I'll just post it here....

I've created a website with a series of custom search engines (e.g. cseA, cseB, cseC, cseD). In many cases a user will want to search the same keyword in more than one of the search engines (but they should not be combined). Right now if a user searches "keyword" in cseA and then wants to search "keyword" in cseB then the user has to click my link to go to the cseB homepage and then retype "keyword". I'd like to set it up so that once "keyword" is searched in cseA, if the user wants to search it in cseB then the user clicks the link for cseB and "keyword" is immediately searched.

I know this is a little confusing so I'll give an example: In google if one searches "london" for the general web search and then on the results page clicks "images" then one is immediately taken to an image search of "london", rather than the google images homepage. This is what I'm looking to achieve.

Thanks,
Daniel
5:45 pm on Feb 10, 2010 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4843
votes: 2


A server side scripting language, like PHP or ASP would do the job, it would populate the URL's with the $query_words required to do the same search on 'images', 'news' etc.

In the Google example, where "q" is the query submitted, PHP can access whatever is put into the search form with the variable $_GET['q'], which you then use for your purpose.
6:00 pm on Feb 10, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 10, 2010
posts:4
votes: 0


Thanks. I have no experience coding PHP/ASP, so I'm imagining something like this is too tough for me to learn relatively quickly? Is this the sort of thing I could find a downloadable script for?

Thanks again.
6:07 pm on Feb 10, 2010 (gmt 0)

Senior Member from GB 

WebmasterWorld Senior Member brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4843
votes: 2


For this task it's relatively easy.

You'd have something like <a href="http://www.example.com/?q=<?php echo $_GET['q']; ?>">Image Search</a>

The PHP is embedded in your HTML and emboldened
9:12 pm on Feb 10, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 10, 2010
posts:4
votes: 0


What url would I put where you wrote "example"? The way I've arranged the search engines they have their 'search pages' and their 'results pages'. So it's like

cseA search: www.site.com
cseA results: www.site.com/results
cseB search: www.site.com/images
cseB results: www.site.com/image-results

Do I include the "cseB search" or "cseB results" url? And just copy/pasting the code you gave me should work?

Thanks again,
Daniel