As of Jan 1, 2012, the McCormick & Winter Corporation will legally be dissolved. For any questions or for ongoing work requests, please contact either Justin Winter (justinlevi@gmail.com) or Susan McCormick (susan@mccormickdigital.com)

03.
Some things
you should
know about us...

We get a thrill from the cutting edge.
That's how we slice through the clutter.

Drupalcon SF - Facebook Applications, Powered by Drupal

M&W recently attended the Drupalcon conference in SF and had a chance to sit in on a few really interesting sessions. Facebook (FB) applications have been around for a while now and most of us are familiar with the super lame “I threw a snowball at you”, or “you got bitten by a vampire” style of app so I wanted to see what else you could do with FB.

This post will be mostly about the session presented by Dave Cohen and the notes I took.

#1 - Why should you care about Facebook? 400 Million users and growing... That pretty much says it all. I know lots of people who don’t spend every waking minute on facebook, but people are starting to use Facebook for lots of different things. Fred Vogelstein had a really interesting article on Wired magazine a while ago about people are starting to use facebook to find out where they should eat, go out, etc instead of using google. This could eventually lead to a huge shift in how the internet is currently being used.

The Facebook API and programming interface has matured a lot over the past few years and there are some really attractive features for developers. Currently the development platform supports Canvas pages & facebook connect. Both platforms could be used to develop mobile and desktop applications.

Canvas pages fall under the Facebook domain, but the whole content area (under the menu and to the left of the ads on the right side of the page). Canvas pages can have any number of pages and contain just about any content. The actual content is hosted on your own server. Canvas pages use a xml markup language called FBML, not HTML. Some example FBML tags are <fb: tabs> <fb:tab_item><fb:title>. As you can see, the markup is very similar to HTML. How do you create FBML pages from Drupal? Short answer, with the theming layer. Creating a custom theme that outputs FBML is very straight forward and allows you to keep the data layer separated from the presentation layer so you could potentially create a regular HTML theme as well and have the same data work in two different ways.

There are few tricks creating FBML pages in drupal which Dave Cohen brought up. In order to serve pages from your domain, it’s important to incorporate URL rewriting. URLS will map in a one-to-one relationship (example.com/x/y/z -> apps.facebook.com/example/x/y/z handled by the same callback). Sessions are controlled by Facebook, not cookies. Therefore, you need to add some code to execute in your settings.php before Drupal gets bootstrapped. Although this isn’t 100% the case, it’s best to assume that javascript won’t work. Also it’s important to build your theme to 760 pixels max.

Facebook also provides another newer set of tools for building applications, Facebook Connect. Facebook connect brings social features to your website, “The other kind of Facbook apps”. Facebook connect is more popular with Drupal users.

There are some interesting Javascript JQuery solutions with Facbook connect, FBJQRY that continue to improve all the time.

The Drupal for Facebook module supports Facebook Connect. Here are a few details about Drupal and FB connect:
Single signed on for all Facebook Connect apps
XFBML
Have to add xmlns:fb attribute tot he page.tpl
Access to FB.Connect Javascript(JS) classes

Canvas pages Vs. Facebook Connect Pages

C: apps.facebook.com/your-app
C: FBML, limited HTML (iframe)
C: FBJS, no JQuery

F: yourdomain.com
F: HTML also FBML
F: JQuery & other JS

Drupal for Facebook Project
http://drupal.org/project/fb

Here are a few features common to both canvas and connect apps (authmap table, wall posts & status updates (streams), profile tabs (similar to canvas pages), extended permissions, request forms, 3rd-party modules (views), extensible via hook_fb().)

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.