• 26Oct
    2009

    An Introduction to Facebook Page Development and FBML(Facebook Markup Language)

    One of the great things about my job is that I get paid to spend time on Facebook. Not only am I head of Web Design/Development, which is easy considering I’m the only guy in the department, recently I have also taking on the role of being the Social Media Manager. One of the tasks I have currently taking on is building our corporate Facebook page. I’ve managed and developed a few pages and groups before for clients when I was freelance and I have attempted to build a few apps for fun, but I’m not an expert in this area. However, I have learned a few things and I would like to share them with you.

    What this post covers

    FBML – The Basics
    A bit of history -  First came FQL (Facebook Query Language) which evolved into the Facebook API. Then in 2007  Facebook launched their Platform in order to complement their API, which uses FBML(Facebook Markup Language), similar to HTML, it allows you to write browser interrupted code to render elements on a Facebook page or application. For example, we can embed FLV’s or SWF’s, insert images, retrieve or send data, etc., essentially creating widgets.

    The only downside is that these widgets can only be used on Facebook!

    Before we get into some basic code snippets, I should mention Jesse Farmer’s post An Introduction to FBML, he does a really good job of breaking down the theory, plus he has included some really good code examples to help you get started. You should also check out the Facebook Developers Wiki.

    Top

    Adding Applications
    The following is mostly for new admins. If you know this stuff you can skip to the juicy content below.

    By default when you create a Facebook page there is a set of standard applications that come with it; Discussion Boards, Events, Links, Notes, Photos, and Video. However, we can add to this set by browsing some of the other applications that exist. These applications are similarity, but not exactly the same as the ones you would add on your personal profile. Typically we are looking at business applications like RSS Grafitti, Slideshare, flickr, YouTube Box, FlashEmbed, and most importantly Static FBML.

    To add an application to your page click on “edit page” (link is under your profile pic when logged in) and at the very bottom there is a “More Applications” option. Click on the pencil icon and choose “Browse More”. This will take you the central Facebook apps page.

    I recommend using the search, for example enter “Static FBML” (no quotes). Once you have found an application you want/need got to the application page and click on “add application to my page” and follow the on screen steps. Go back to you Facebook page and under “edit page” you will find your new application ready to go.

    Top

    Static FBML Box (Basically a widget)
    For starters you will need to install the Static FBML application mentioned above. The nice thing about this widget is you can write HTML in it. So, for example if you want to load some graphics like banners, logos, etc., you can use <img src”">. You can also link these images with <a href=”"> and so on. You cannot run JavaScript ONLY basic CSS/HTML!

    Top

    Adding Your FBML Box or Tab to Your Page

    • In “edit page” find the “Static FBML” link, click on the pencil icon and select “edit”
    • Enter the name you want to appear in the box heading in the “Box Title” field
    • Enter the HTML content in the “FBML” field
    • When you’ve added in your HTML — click “Save Changes” and view your page to see the results.

    Unfortunately there is no preview option.

    *A few tips on dimensions – If you want your FBML box to appear in the left column of your Wall, set the width to 180px and/or if you want it to appear in the tabs in the main Wall column, set the width to 600px  width or less.

    Top

    FBML Examples
    Here is an example of a page I am working on (not published yet).This FBML box is on the left column. All I have done is called an image and linked it to a Twitter profile using standard HTML.
    fb_left_column

    Let’s take a look at some FBML. Here is some simple code to embed a swf in the Static FBML box (this is if you wanted to do something like the Apple Students page “On Campus” tab). To do this I used the fb:swf tag which allows me to render a SWF object. Notice I also load an image file, this is because an image will appear first, when the user clicks on the image, it turns into the SWF object. We can do the same thing with an FLV.

    <fb:swf
    swfbgcolor="ffffff"
    imgstyle="border-width:3px; border-color:white;"
    swfsrc='http://www.yourdomain.com/mymovie.swf'
    imgsrc='http://www.yourdomain.com/myimage.jpg'
    width=600' height='450' />
    

    and to load an flv…

    <fb:flv
    src='http://www.mediacollege.com/video-gallery/testclips/barsandtone.flv'
    width='400' height='300' title='my movie' color='#FFBB00' salign='r'
    img='http://www.example.com/test.jpg' scale='showall'/>
    

    and just for fun, here is how you load an mp3

    <fb:mp3 src="http://host.com/file.mp3" title="Song Name" artist="Song Artist" album="Album Name"/>
    

    Top

    The FBML Test Console
    Now that we have covered some of the basics let’s take a look at the  Facebook Developer Tools. You may not be aware that Facebook offers a bunch of free online developer tools to help you learn, test, and eventually deploy your apps. For this example I will go through some basic FBML embedded in HTML.

    Using the  FBML Test Console we can input our code and get a Facebook Box preview. The FBML Test Console will also output the HTML source if you need to embed it elsewhere.

    How it all works

    • Log into to Facebook
    • Got to Facebook Developer Tools
    • Click on the FBML Test Console Tab
    • You will notice that the tool will automatically retrieve your user ID and API Key
    • Input code in the left box
    • Click on “Preview”

    *Notice the Position dropdown menu, here you can choose from standard Facebook layouts like feed body, request form, etc.

    fb_test_console

    In this example I am using some test code I found online(can’t remember where), to retrieve user profile pic and name. I create a basic HTML table and embed the fb:profile-pic and fb:name tag in adjacent cells. For the fb:name tag I use 3 attributes, useyou=false, uid=(whatever user ID you want to retrieve), and firstnameonly=true(in the last cell I change it to false). For the fb:profile-pic I use 1 attribute uid=(whatever user ID you want to retrieve).

    Here is the code I inputted (remember to change the uid=xxxxxx to an actual user Id)

    <table cellpadding=0 cellspacing=0><tr><td>
    <table cellpadding=0 cellspacing=0>
    <tr><td>
    <fb:profile-pic uid=xxxxxx></fb:profile-pic> </td></tr>
    <tr><td>
    <fb:name useyou=false uid=xxxxxx firstnameonly=true></fb:name>
    </td></tr></table>
    </td><td>
    <table cellpadding=0 cellspacing=0><tr><td>
    <fb:profile-pic uid=xxxxxx></fb:profile-pic> </td></tr>
    <tr><td>
    <fb:name useyou=false uid=xxxxxx firstnameonly=true></fb:name>
    </td></tr></table>
    </td><td>
    <table cellpadding=0 cellspacing=0><tr><td>
    <fb:profile-pic uid=xxxxxx></fb:profile-pic> </td></tr>
    <tr><td>
    <fb:name useyou=false uid=xxxxxx firstnameonly=true></fb:name>
    </td></tr></table>
    </td></tr></table>
    

    This is what it outputs
    fb_test_console_preview

    Once you have a basic understanding of FBML you will find this tool very useful for testing code and playing around. You may also want to check out this great post at devtacular on How to Style an Application Like Facebook this post includes a complete Facebook Component Stylesheet!

    Top

    Creating Custom Tabs
    It is important to create custom tabs that represent your page/brand beyond the basic Wall, Info, Photos, Events, etc.  Most successful pages use custom tabs to sell their products or services, watch demos and presentations, enter contests and so on. A good example is the Apple Students Page, they have a tab called On Campus which launches a really slick Flash app with videos, a google map mashup, and some ads.
    fb_applestudents

    The other bonus of custom tabs is the ability to set it as the default landing page. In your page settings you can choose which tab is set as the default, most people just use the Wall. A good example is the Nokia Page, which defaults to Nokia Twist-USA.
    fb_nokia

    How do I create a custom tab? Easy! First you need to make sure you have added the FBML Application to your page. Without it you can’t create any custom widgets to display as tabs(you can also use these steps to add any of the default applications as a tab).

    Click on “edit page” (link is under your profile pic when logged in) and under Applications click on the pencil icon on the top right corner of the application you want to add as a tab.
    fb_app_settings

    Click on “Applications Settings”.
    fb_fbml_settings

    You will be giving 2 options, add/remove from Boxes and add/remove from Tab. Click “add”. Now go back to your page and refresh and you new tab should be there.

    Top

    Removing Tabs
    Removing tabs take only a few seconds.

    Click on any of your tabs. When that page loads you will notice the tab is white and a pencil icon appears next to the tab name. Click on the pencil icon.
    fb_to_delete_tab

    Click on “Delete Tab”. Told you it was easy!

    The only tabs you cannot delete are Wall and Info.

    *A quick tip about the Boxes tab – You can remove the boxes but not in the same way as others. To remove the boxes tab first you need to click on Boxes. When the page loads remove each box that is under this tab (the same steps as above). Once there are no boxes left under the Boxes tab go back to your wall. The Boxes tab should be gone, if not refresh a few times. Essentially this tab only exists if there is something in it!

    Top

    Here’s a list of some really nice examples
    http://www.facebook.com/officelive
    http://www.facebook.com/applestudents
    http://www.facebook.com/livescribe
    http://www.facebook.com/nokia
    http://www.facebook.com/Starbucks
    http://www.facebook.com/adidasoriginals
    http://www.facebook.com/Paramount

    63 Responses to An Introduction to Facebook Page Development and FBML(Facebook Markup Language)

    1. November 25, 2010 at 7:03 pm

      I need some help is there anyway of getting in contact with u such as an email address so that I can show u what my problem is….Thanks

    2. Andy Freeman
      December 1, 2010 at 11:02 am

      I go to the developer tools section on facebook but there is no FBML Test Console App only a Javascript SDK test console. When I try my FBML in this it wont render my fb:swf tag at all, even though my fan page renders it correctly. What is the recommended way of previewing FBML before making it live?

      • liz
        December 1, 2010 at 2:17 pm

        Andy – FB is moving away from FBML — I believe they have taken down the FBML platform. I was looking for the same type of tool too…this post was from 2009, a lot can happen in a year :)

    3. Pingback: Women With Moxie -- Sarasota business networking for women.

    4. December 22, 2010 at 4:48 pm

      Hi.
      I used the test page and it came out the way I want it! But, when I enter the same code in the fbml edit page, the results are different! Please help!!
      this is my code:
      welcome

      why is it not working??? help!???

    5. January 17, 2011 at 2:58 am

      Very interesting post. I really enjoyed reading it.

    6. May 7, 2011 at 10:25 am

      Facebook is moving away from FBML grrr I forgot that iFrames was in and FBML out. No wonder I am facing much frustration in the configuration of my FB page…grrr. FBML would have been applicable before the update. Anyway, knowledge is NEVER wasted. It is a great tutorial with all its step by step diagrams but it would have been nice to get one on iFrames. Notwithstanding it applicability (non) to the my configuration I am thankful for the info. Off to do some research. Again thanks.

    7. phyfun
      June 2, 2011 at 11:15 pm

      Good post, thanks for sharing. I would like to have a try at facebook. I think I can create some interesting page with this.

    8. Pingback: On Bookmarking: Facebook

    9. September 21, 2011 at 8:15 am

      Hi Brendan,

      I am trying to get a tab with an integrated pdf link for fans of my page up and running. I used the tag for this tab:
      http://www.vienna-unwrapped.com/ViennaIn10Objects_app.html

      When I tested it on the Facebook app console, this code came out – I am not a developer and have no idea what to do with this.

      {“error_code”:3,”error_msg”:”Unknown method”,”request_args”:[{"key":"method","value":"fb:visible-to-connection"},{"key":"access_token","value":"AAAD4s9okz5EBAAq6K8Jyls6IxPj6C7kDf8vkQsr08kVwbkMJ1OuUisBzjOgELSoAoasfUi7mfZBMG7AxGxr2KVKDSzPH0arnkfOZBoRwZDZD"},{"key":"format","value":"json"}]}

      Please can you help me shed some light on how to proceed. Apparently non fans can currently see the link, so I need to change something.

      many thanks
      Barbara

    10. October 21, 2011 at 7:23 pm

      hello
      i used the code of swf for my website whitch use xml . i tried this fbml code

      but not work how how can i embed an swf whitch work by xml ?

      thank you