• 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. Jenn
      April 23, 2010 at 11:40 am
    2. Pingback: Jazz Up Your Facebook Fan Page With FBML

    3. Kevin
      April 28, 2010 at 10:47 am

      Hey Brendan,

      Thank you so much for your help with the video embedding within the FBML tab. I had one question though. Using your code as a go-by, I was able to place some of my YouTube videos within the tab using the standard embed code provided by YouTube. The video will appear in Safari and Chrome, but does not work in Firefox. Is there any workaround for this or do you know of any reason why this may have not worked for Firefox?

      Thank you so much for your help!

      Kevin

    4. Kevin
      April 28, 2010 at 10:55 am

      Brendan,

      This post is extremely helpful. I was able to use your .swf code as a go by as I placed in my embed of my youtube videos. I was able to get this to work in Safari and in Chrome, but not Firefox. Does anyone know why this may be or if there is a workaround.

      I appreciate your help!

      Thanks,

      Kevin

      • Kevin
        April 28, 2010 at 10:56 am

        Sorry for the duplicate posts…I didn’t think the first went through.

    5. May 11, 2010 at 4:44 am

      Hi

      Any Idea how this has been done:
      http://www.facebook.com/stevespangler
      Video on top of an image?

      Thanks

      Ilan

      • webmaster
        May 23, 2010 at 9:27 pm

        It’s just basic css! The image is a bg for a div, then the movie is place inside that div.

        • August 6, 2010 at 2:46 am

          How can a novice get or copy some basic CSS to do what was said above?

          “Hi

          Any Idea how this has been done:
          http://www.facebook.com/stevespangler
          Video on top of an image?

          Thanks

          Ilan”

          I have no idea how to do CSS.. I can usually figure out the html, fbml after playing with it.

    6. kathy
      May 14, 2010 at 10:46 am

      thanks much. now can someone tell me how to get my new tab to be first when a non fan comes to the page? thanks in advance :)

    7. Kiss
      May 17, 2010 at 1:52 pm

      Hi, this site really helpful. I just want to ask how to make this on my left side column like http://www.facebook.com/Starbucks#!/Starbucks?v=wall under videos when click it popups?

    8. May 24, 2010 at 12:42 am

      Hi, I just want to put a welcome tab on with an embedded image? helppppp

    9. Tim
      June 9, 2010 at 6:50 am

      btw.. there are facebook page templates already! created especially for the FBML application.. not much of them though.. for instance here – http://www.flashmint.com/show-type-facebook.html

    10. Luis Baptista
      June 22, 2010 at 8:27 pm

      Amazing post, thank u so much!!!
      I have one question, how to i make my tab with the FBML the first one to appear when someone navigates to my page?!
      Thanks.

      • July 27, 2010 at 9:34 pm

        on your “wall” of your page, there is a link called “options” it is right under your post box. Click that and you will see “settings” click that, there is a pop out that has “View Settings” the second selection is “default landing tab for everyone else” Set this as your “Welcome” page, or your Landing page you want guests to land on. Hope this helps

    11. Jelle
      June 30, 2010 at 3:22 am

      Excellent post.

      Also have a question: how can i get a simple RSS feed to work on my FBML tab or wall box? Thank you.

    12. jaye
      August 5, 2010 at 9:57 pm

      How do i add a simple link in FBML box to another webpage.
      I put my link code in and it seems to add code
      <a href=”http://www.mysite.com/myproductpage
      and it seems add extra code to the link
      Thanks a million

    13. Snubby
      August 6, 2010 at 3:44 pm

      I am a bit confused… Maybe you can help..

      Ive added the static fbml app but sometimes my fbml doesnt work…
      For example:

      Custom Height/Width

      do u know why this doesnt work? I simply get white?
      thanks…

    14. Snubby
      August 6, 2010 at 3:46 pm

      I am a bit confused… Maybe you can help..

      Ive added the static fbml app but sometimes my fbml doesnt work…
      For example:

      Custom Height/Width

      this works in the test console but not when i paste into my fbml edit box???

      do u know why this doesnt work? I simply get white?
      thanks…

    15. Snubby
      August 6, 2010 at 4:12 pm

      sorry it processed my code try this:
      <!– –>

      hopefully the comment tags work

    16. leon vangelis
      August 10, 2010 at 2:28 pm

      Hey there,

      Could i ask for your opinion? Im planning to make a some new fbml tabs in my corporate page but im not sure whether to use a flash page or just an html…

      As i see so far most companies use simple pages with embeded elements such as video etc.

      Flash is always more impressive but im wandering if it could cause problems during loading etc.

    17. mona
      August 21, 2010 at 2:16 am

      Hi, I need some help with the FBML code.

      I Would like to display an image when user visits my page, After becoming fan I would like to display the “Invite Friends” box instead of that image.

      Here’s my code…but not sure why it’s not working..
      Could you please help me with this?? thanks again
      Much appreciated !!

    18. September 17, 2010 at 12:00 pm

      this is a nice post any ideas on how to get image maps to be retained they seem to not translate onto fb tab suppose Ill just do a set of absolute DIVs

      thx

    19. November 8, 2010 at 10:54 pm

      Your blog is incredible, thank you so much for all the tutorials! I’m not particularly tech-savvy, so I really need the step-by-step instructions, and yours are by far the best I have come across so far. Keep up the excellent work! :D

    20. morgan
      November 10, 2010 at 8:27 pm

      i cant remove the tab. when i click it the page is blank

    Leave a Reply

    Your email address will not be published. Required fields are marked *