Skip to main content.
Returning member? Please Login
Navigation:
My Profile My Mail My Experiences My Goals My Stories My Circle My Recommendations
Log In Register
Stories Home Popular Today Search Stories Browse Dreams
Browse Confessions Confess!
Community Home Search People
Experience Groups Home Goals and Planning Home Search Groups
Random Experience Random Member Random Story Random Commenting Music Music for your Mood Music Meanings Music Quiz Blogs Recent Blogs For Fun Daily Survey Daily Interview How Are You? Daily Question Search Snoop Spread the Word
Your Story Your Confession Your Dream

The Blog of padrenel


Members can use our free journaling service to keep track of their day-to-day thoughts and feelings. Think of it as a diary that you can choose to share or keep private. We're having a lot of fun here, so login or join us today-- it's free and anonymous, and you can be participating in seconds

Do Something
New Post Get your own free blogSend padrenel a private message Message padrenel
Browse
See padrenel's Blog See Public Blogs padrenel's Profile
Share
Invite Friends to this Blog Send to Friends Bookmark this member's blogs Bookmark This Blog
Sponsors
Help
Why Blog With Us? How to Embed Photos in your Blog Embed Photos How to Embed Videos in your Blog Embed Videos

Previous Posts
10 Things That Would Have Been Nice to Know When Starting My Facebook Application

Subscribe
AddThis Feed Button
Address of this blog:
http://padrenel.blogs.experienceproject.com [share] [bookmark]
Jun 6th, 2007

10 Things That Would Have Been Nice to Know When Starting My Facebook Application

Alright, just finished my first Facebook app.  Some pretty cool functionality they've built there, and it's mostly pretty straightforward to work with, but the documentation is lagging in some areas.  Here's a few things I learned along the way, in no particular order - most may seem like no-brainers, but I know I lost some time to most of these!

1) They seem to be pushing php5, I needed to use php4.  Cost me a day figuring out how to make this happen.  They link to an unofficial php4 port off the developers page, but this isn't really functional as written.  So, starting with this port, and using the official php5 api as a model, there are a few things to tweak.  Get rid of the static methods, and the try/catch functionality.  There are a a few places within the FacebookRestClient implementation that you need to prepend "$this->" to those previously static methods.  For the constructor, it should be named after the class name, not "construct."  Note that in facebook.php, the call to new FacebookRestClient has the wrong parameters.

This should help you get started if you need to use php4.  Also note that if you download the php5, hidden in there is a folder with a php4 port - I haven't tried that one yet.

2) Session-keys - in putting together a simple app, I haven't found a need to store each user's session key.  For cases where I need to push content to the profile, I just use my own (infinite) session-key, in a global sense.  I can just do something like set_user($my_user_id, $my_session_key) - no need to call set_user for each installed user!

3) Updating profiles - there are a couple options here.  In any case, first set the user's profile in the post-add script (profile_setFBML).  Now, let's say you want to update a profile periodically, or on a certain action.  From an action, it's easy - you already have the correct user (passed through fb_sig params), so just call profile_setFBML again.

To do a more periodic update, you can just iterate over all your users, get their uids, and call profile_setFBML() on each.  Remember, from above, you don't need to call set_user for each, just use your own session_key.

Another option is to use fb:ref, as the documentation seems to recommend.  For each profile, you initially set the original profile (using profile_setFBML) to something like "<fb:ref url="http://www.example.com/profile.fbml">".  Then, when you want to update user's profiles, you can just update the fbml on your end (profile.fbml), and then call fbml_refreshRefUrl("http://www.example.com/profile.fbml") to push the update.  Note, if your application displays the same fbml to each profile, you just need to call this refresh once.  If you need to take the uid as a parameter, however, you still need to iterate over your users, calling refresh on each.

4) If you're developing multiple applications, make sure you check your api key and secret values.  Sounds basic, but something I missed while cutting and pasting between apps, and the errors you see aren't quite obvious.

5) Speaking of errors, remember to use the few debugging tools they do give you.  Use their test consoles to see what your query outputs will look like, and how your fbml will render.  It's much easier to debug at this stage then in the running application.  Once running, remember you can view source on any canvas page and see the original fbml, pre-rendered.

6) A lot of my errors stemmed from poorly-formed html / fbml - forgetting to close p tags, etc.  Things that a normal browser wouldn't complain about will cause the Facebook parser to error out.  Note, as the application developer, these errors will show up on your page.  However, if you're working on a project with someone else, and you aren't the creator of the app, this output may not necessarily show.

7) Have some issues with how your fbml/html renders?  Having problems laying something out just right?  Use a tool like Firebug and/or Web Developer (both Firefox extensions) to help you examine the source.  You can see how Facebook is styling your elements, what Facebook classes you can use in your own styling, etc.  One example I ran into - trying to create a checkbox within an fb:editor form caused all sorts of sizing and layout issues.  Looking at the css, Facebook had assigned a "width:100%" to the input tag.  I overwrote this with a "style=width:auto;" and everything worked fine.

8) Get help if needed!  Past their main documentation page, which can be a bit incomplete, check out the platform wiki.  A ton of useful information here, including step-by-step tutorials and more detailed descriptions on the available fbml tags.  I found it useful to monitor the developer group's discussion board - a lot of people going through similar issues and a wealth of tips and advice, both for people just starting out and for people looking for more advanced functionality.  People are generally open and helpful - you might even make a new friend!  Also check out the IRC channel - the conversation's a bit more disjointed, but Facebook employees are around to answer questions.

9) There's a major application directory backlog, so keep that time-line in mind while building an app.  You can submit once done, but realize that you'll probably have a few days to deal with any final tweaks before it's actually reviewed.

10) Finally, have fun!  There's a ton of possibility here, with Facebook opening up their network to the hordes of talented developers.  Let's see some creative, novel, exciting apps out there!


If you appreciated this article, please consider adding our latest Facebook app, called, "My Moods"-- It lets you set custom moods, choosing from over 100 emotions and smileys. You can also mention your friends in your mood. We're pretty proud of it, and it exercises all of the lessons above. Thanks!

http://apps.facebook.com/mymoods/

Also, check out our other application, My Goals
. It allows creation of personal goals ("I will Climb Everest", "I will Pass Finals"), with optional deadlines, shared with your friends.




   1-1 of 1 Blogs   
First | Previous || Next | Last
Sign Up Now!

Anonymous & free
Join millions & get access to everything we have to offer in seconds

Choose a username:

Choose a password:

Your Email:

Age Range:

Already have an account?
Be YOURSELF

Be a part of the first social experience place on the web. Where who you are is more important than who you know. Share what matters the most and find others who just "get it."

Join now and get started in seconds, or learn more about Experience Project

Love Stories

Check out hundreds of real stories about love.

And so much more!

Of course, we love to hear Your Story, whatever it happens to be. You can be yourself here!

What's New

Now explore EP in a brand new way using the random story, or random experience links. Discover life through the experiences of others!

Support EP
Hearts to Support EP

If EP is important to you, please consider supporting us.

Support EP

Share the Love

You can now import your address book and quickly let your friends know about EP (you don't have to share your username).

You can also show your EP pride by putting a badge on your blog or website. Earn points by sharing!

Spread the Word

Horoscopes

Just for fun, we've added
free daily horoscopes!