|
Can I have a Twitter search box / button on my site?I think that Twitter is pretty darn cool and would really like to be able to add a Twitter search box to my web site. In fact, I'd love to have some buttons that are pre-defined searches, like for the name of the latest movie in the theater or a celebrity too. Are those possible? I haven't seen anyone do anything like that before... Everything's doable! The question is "how much of a nightmare would it be to add this?" and the good news is that the Twitter search system is incredibly easy to work with, and, better, it also has a sophisticated search engine so you can refine those buttons to filter out false matches (imagine the tons of false hits you'd get from the movie "Push", for example). It all starts with search.twitter.com and a bit of HTML knowledge. What we'll do is grab the URL from a search for those buttons, then reverse engineer the code needed to make their search box work and create an HTML code snippet that'll offer the same functionality. Ready? First off, go to search.twitter.com and search for "Avatar" as a test. You'll end up with a Web page address (URL) like this: http://search.twitter.com/search?q=Avatar
That's really all you need to create a rudimentary button: just use a graphic or text link and have that as the link. For example: Easy, eh? The source to that: <a href="http://search.twitter.com/search?q=Avatar">Avatar buzz on Twitter</a>
Without a detailed explanation, I'll say that any time you see a URL of this type, you can also unwrap it and make it into a simple HTML form too: <form method="get" action="http://search.twitter.com/search">
<input type="hidden" name="q" value="Avatar" /> <input type="submit" value="Avatar buzz on Twitter" /></form> When we actually include this code, we get this: Cool, yes? Now, let's turn that into a search box. It's quite easy, actually, and the code looks almost identical: <form method="get" action="http://search.twitter.com/search">
<input type="text" name="q" /> <input type="submit" value="search Twitter" /></form> Well, let's add a prompt to it so you know what you're typing in and move things around just a bit: <form method="get" action="http://search.twitter.com/search">
Search Twitter for: <input type="text" name="q" /> <input type="submit" value="go!" /></form> Let's see how that looks: Nice, yes? From here you can tweak and fiddle to your heart's content, but between the different ways I show to unwrap the search.twitter.com URLs you should be able to set up just what you want on your page!
Categorized:
CGI Scripts and Web Site Programming
,
HTML and CSS
,
Twitter, LinkedIn and Social Network Help
(Article 9324,
Written by Dave Taylor)
Tagged: cgi, html forms, twitter, twitter search Previous: What kind of MacBook Pro do I need to run Final Cut Studio? Next: My LG Cellphone is locked and needs a PUK code. Help! Subscribe!
Rather amazingly, there are no comments on this article yet.
I have something to say, now that you mention it, but ...
I do have a comment, now that you mention it!
|
Recommended
Recent Entries
Search
I Need Help!
Apple iPad Help
Articles and Reviews Auctions and Online Shopping Blogs and RSS Feeds Building Web Site Traffic Business and Management CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above Facebook Help Google Plus Help HTML and CSS Industry News and Trade Shows iPhone and Cell Phone Help iPod, Sony PSP and MP3 Player Help Mac OS X Help Pay Per Click (PPC) Advertising Search Engine Optimization (SEO) Shell Script Programming Tech Support Video Help The Writing Business Twitter, LinkedIn and Social Network Help Unix and Linux Help Video Game Tips and Help Windows PC Help WordPress Help |