Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

Can I add a Wikipedia search box to my Web site or blog?

I found instructions for adding a cool Google search box to an html/xhtml site, here on askdavetaylor. I want to add a similar Wikipedia search box to my website. Any advice on where I can get code to do this?


Dave's Answer:

There's always a way to do this sort of thing and Wikipedia is a splendid example of exactly how to reverse engineer a search box and pour it into a rudimentary form. Let's dig into it and you'll see what I mean!!

Go to the site's home page and you'll see that they have a very simple search box with no fancy bells and whistles:

Wikipedia Search Box

The only fancy part is the language selector, but that's easily duplicated if you want to be truly polyglot on your site. If not, the default is English so that might work just perfect for your needs.

One way to do this is to just copy and paste from their page source, which looks like this:

Wikipedia Search Box: HTML source

I prefer doing things for myself, however, but this gives me all the information necessary: the name of the target CGI search utility and the names of the variables involved. Stripping it to its most basic, pre-selecting English, and carrying across the hidden variable from the source, here's how a crude Wikipedia search might look:

<form action="http://www.wikipedia.org/search-redirect.php" method="get">
<input type="text" name="search" size="20" />
<input type="hidden" name="language" value="en" />
<input type="submit" name="go" value=" > " />
<input type="hidden" name="go" value="Go" />
</form>

Turns out we can clean this up just a little bit and make it more friendly too:

<form action="http://www.wikipedia.org/search-redirect.php" method="get">
Search Wikipedia:
<input type="hidden" name="language" value="en" />
<input type="text" name="search" size="20" />
<input type="submit" name="go" value=" Go! " />
</form>

That's all there is to it. Here, try it:

Search Wikipedia:  

Simple enough, eh? Hope that helps you tap into the splendid resource that is Wikipedia.



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

Dear Dave,
I am just starting with web design. Though I am a dentist here in this third world country the Philippines, I am doing this because life is hard here in this part of the world.
Actually, I have 2 questions:
1. How do you make a page where when your client scrolls down, the background does not move? Only the contents like texts and graphics move.
2. How do you make this form in your site where the answers to the text boxes are sent to your email?
3. If I would make a personal search box, how would I make the page where the list of search results will be placed?

Thanks and more power to you

Day

Posted by: Day Magtoto at July 24, 2007 6:25 PM

where can i get the source code for wikipedia but in php4 format?

I tried hard to find it but to no luck

please help!!!

Posted by: wayne at March 13, 2008 6:29 AM

Wayne, I don't know if it's in PHP4 or not, but Wikipedia's back end is called "Media Wiki" and you can Google that to find out a lot more information about the application. It is free and you can download it. Good luck!

Posted by: Dave Taylor at March 13, 2008 11:03 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]