When you work with Facebook fan pages or applications, you may have encountered instances where you needed to write in FBML, or Facebook Markup Language. FBML resembles HTML with elements created specifically for Facebook purposes. In this short tutorial, I will show you how you can take advantage of this simple markup language to add a comment box to your Facebook page.
Facebook has made some changes with some of the parameters that can be used with the fb:comments tag in Facebook pages. For example, the candelete parameter, which allowed users to delete comments, no longer works. Instead, it is now replaced with an option to report any comments for spam or any other reasons. Also, the send_notification_uid does not work on Facebook pages. Thanks for all the great comments, guys!
In order to add the comment box, you need to have the Static FBML application added to your Facebook page. Then, proceed to the edit page and add the following snippet of code wherever you desire:
<fb:comments xid="your_id_here" canpost="true" numposts="5" publish_feed="true" simple="false"> <fb:title>Join the conversation!</fb:title> </fb:comments>
This will output something resembling a Wall you will find on profile pages.
Let’s go over the various parts in the snippet:
This is the unique id you will assign to your comment box. For example, if your Facebook page is called Nike Golf Shoes, you can assign the value “Nike_comments” The label can comprise of alphanumeric characters (Aa-Zz, 0-9), hyphens (-), percent (%), period (.), and underscores (_)
This property determines whether the viewer can post a comment on the page. It takes values of either “true” or “false.”
If set to true, the Post comment to my Facebook profile is checked automatically. The comment must be at least 5 words in length in order to be published to the user’s feed. Otherwise, this parameter will remain at its default value of false.
This property determines the maximum number of comments to display on the page. The default value is 10.
If set to true, this parameter removes the rounded grey box around the Add a comment… link. Default value is false.
For more information on the FBML tag, fb:comments, check out the Facebook developer page.
In other news…