Archive

You are currently browsing the Miles Per Hour blog archives for August, 2009.

Aug

13

Drupal Module: Yelp Search Results

By mike@mike-miles.com

I had a bit of free time recently, so I began reading up on some of the new API’s that different websites have come out with (Digg, Yelp, etc…).  When I found the Yelp API it sparked an idea for a new Drupal module I could build.

Of course I first took a look around the drupal website to see if a module already existed, so I wouldnt waste my time, and suprisingly it did not.  Excited I planned out what I wanted to have the module do (after reading Yelp’s extensive restrictions list of what you can/cant do with their API). Since I’ve had alot more practice developing modules since publishing my first one (callouts), I gave myself just 2 days to code, complete and publish this module.

So yesterday (August 12th 2009) I began working on it, and am excited to say I’ve completed the module and it’s just as good as I would of hoped.

Enough of the back story, onto the module itself:

Yelp Search Results

This Module uses the Yelp API to display search results in a block on your site.

The module creates a new block (‘yelp search results’) which you can place on your page from the block administer section.(Administer > Blocks).

For individual site pages (nodes) you can specify settings for the yelp block (Block title, location, search radius, maximum number of results and which yelp categories to search from).So you could display the 5 best rated Hotels near you on one page, and the 10 best bars near you on another page.

Initially the module will just display photo, name, rating, address & phone for each search result. The display of search results is completely themable and provides you with alot of information you can display (such as reviews, longitude & latitude, etc..) for a complete listing of variables available to you open ‘yelp-business.tpl.php’ and view the comments.

There are only 3 draw backs:

  • You need a yelp API key to use this module (can get for free from http://www.yelp.com/developers/getting_started/api_access)
  • If you have a very high traffic site, the module might stop working (yelp allows you 10,000 API calls per day).
  • Per the Yelp API Terms of Use, you have to display the Yelp logo along with your results (the only part that is not themable.)

You can see an example of this module in action at: http://mike-miles.com/drupal/

A few screen shots

Results Display

Results Display

Editing a Yelp block

Editing a Yelp block

Listing of Blocks

Listing of Blocks

You can download the drupal module for your drupal site, from its offical module page: http://drupal.org/project/yelp

Bookmark and Share