views:

98

answers:

2

Hi,

IU am trying to create my first Application running inside an Facebook Canvas/IFRAME. I am using Zend Framework (PHP) for this project.

But I am not able to understand all the different ways facebook is offering.

There is an PHP SDK wich works so far. There is an Javascript SDK and something called FBJS? Does someone know a good point to start? The Documentation is not up to date most times.

I have managed it to login, and show my picture and name inside the app, the basic stuff is working.

+1  A: 

Facebook JS is how you can use your own javascript in a facebook page, without colliding with or interfering with facebook. It does this by rewriting your javascript, therefore you need to work around how the javascript is rewritten, and use facebook's provided library for ajax and events, not your own such as jQuery, and in a lot of cases, not even the browser's native api.

The javascript SDK allows you to access facebook data from another site using javascript. The Social Graph API has increased the potential for this access, and also has expanded it's power.

Serverside data access = through the provided php api.

Clientside data access = through the javascript SDK.

FBJS, on the other hand, is facebook's adoption of javascript for canvas applications.

CodeJoust
Hum but JQuery is working inside my APP?
ArneRie
That's because you are using an iFrame canvas page. FBJS only applies to FBML canvas pages. A lot more freedom with an iFrame. http://wiki.developers.facebook.com/index.php/Choosing_between_an_FBML_or_IFrame_Application
Andrew
+1  A: 

Canvas App - facebook puts your code directly to the page (well, kind of), you have access to FBML (facebook specific tags), limited HTML, CSS (cached on Facebook side) and limited JS known as FBJS (a wrapper for native JS commands for security reasons, no jquery or anything like that). Your canvas app is still hosted on your server though, and you can use Facebook PHP API on a server side (and anything else you wish, it's a page on your server).

Frame App - facebook just puts an iframe on the page embedding some page on your server. Iframe could contain anything you want, it is just a regular page with no extra requirements. You can use HTML, JS (jquery etc), Facebook PHP API on server side. There is no FBJS as it is not needed, but you can use JS API (with similar functionality to PHP API, only for frontend). FBML is not directly supported, but you can use FBML tags on any site after declaring them:

<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"&gt;

Advantages of using Canvas App - no annoying iframe scrolling, quick access to FBML, and more close integration as a whole.

serg
you make my day!
ArneRie