Archive

You are currently browsing the archives for the Drupal category.

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

May

6

My First Drupal Module

By mike@mike-miles.com

Recently while working on a drupal website for a client, I needed to build in some custom functionality.  For drupal this is’nt an issue, basically anything you need to do has been done before and you can find a module in the module directory.

But after searching I was unable to find a module that did what I wanted, so I had to develope one (Which for a nerd like me was really fun).  It took me a day or two to build, and refine but I built a module that I was happy with.

The great thing about Drupal is that it’s all open source, and anything built for drupal is covered under the GNU license. Drupal thrives on user submitted content and projects, so I decided I would submit my module to give back to the community.  Submitting a module is a bit of a process, you need to submit a proposal, get approved, create an account and create a project page.  The Drupal moderators must of liked my module thou, because it was approved!

So I now have my first (hopefully of many) official Drupal module available for download on the Drupal website.

Now for the good part, here is all the info on the module:

Callouts

Callouts creates a way to display multiple blocks that are related by taxonomy terms. After you place the module into a region on your site, when a user goes to a page any callout blocks (callout is a new content type) with the same taxonomy terms as that page will be displayed in the region.

This Module is great if your looking to show related products in an e-commerence environment, or announcements depending on what page of the site your users are on.

You can downlaod the module for your drupal installation at http://drupal.org/project/callouts