FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Search Your Web Site with Yahoo!





mannrak2003
Offer your readers a way to search your sitewithout hiring a team of developers to build it.
As a serious web addict, I'm frequently frustrated by sites that don't offer a way to search their content. Navigating through a maze of different sections, trying to find that one piece of information I'm after feels like a waste of time. Often I'm forced to leave the site, bring up Yahoo! Web Search, and use its site: meta keyword. The site: shortcut lets you specify that the search results should be limited to a single domain.
For example, if you browse to mountaindew.com, you're immediately blasted with metal music and an extreme Flash animation showing various extreme sports. But all I'm after is the number of calories in a can of soda, and there's not a search form in sight. I could try clicking on a few of the menu items, but I'd probably find more images of skateboarding than useful information. So I surf over to Yahoo! and type:
site:mountaindew.com calories

In a few seconds, I have a specific link deep within the mountaindew.com site that has the information I'm after
PepsiCo, Inc. (the owners and operators of http://www.mountaindew.com) probably has the budget and team of developers to build its own search engine for the site if it wanted to. But many individuals and small businesses don't have that luxury. Since Yahoo! is probably already indexing any pages you have on the Web, you could easily give your readers a shortcut to searching your site with a custom Yahoo! search form.
6.4.1. The Code
In addition to the site: meta keyword, some tweaks to a standard Yahoo! Web Search URL will also limit results to a single domain. Here's a search URL that will return the same results as the previous example:
http://search.yahoo.com/search?p=calories&vs=mountaindew.com

As you can see, the p querystring variable holds the search query and the vs variable indicates the domain to limit the search results to. Armed with this information, here's a bit of HTML that will build the proper URL:
<form action="http://search.yahoo.com/search">
<input type="text" name="p" size="34" />
<input type="submit" value="Search" />
<div>
<input type="radio" name="vs" value="" id="websearch" />
<label for="websearch">Search the web</label>
<input type="radio" name="vs" id="sitesearch"
value="insert your domain" checked="checked" />
<label for="sitesearch">Search this site</label>
</div>
</form>

6.4.2. Running the Hack
All you need to do to customize the code is insert your domain name in the second radio input tag. You can add this HTML to any existing web page to provide your readers with a way to search your site.
The "Search this site" option will be selected by default, but users could also search the entire Web from the form. While this won't make your site as extreme as http://www.mountaindew.com, at least your visitors will be able to find exactly what they're after.
n0obie4life
Copy + Paste.
No quote tags.
No credit.

If you think I'm wrong in anyway, please inform me.

-close-
Related topics
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.