custom tags – Stay N Alive

Facebook Launches Custom Tags, Helps Developers Share Their Code

Facebook just released documentation about a brand new feature surrounding FBML that I think is game-changing. They call the feature “Custom Tags”, and the concept is simple. You create code on your servers that renders Facebook-compatible code. You register that code as a “custom tag” on Facebook’s servers, set it as private or public, and now you can represent that code you just wrote as a simple FBML tag. Here’s the clincher: You can make your tags available to other developers!

So here’s an example, based on their documentation (it looks as though the documentation is still being uploaded so it is limited at the moment):

Let’s say you create some code that generates FBML code that looks like this:

(${attribute_name} will be used to replace any attributes passed to your custom tag.)

All you need to do is register that tag in your server-side code (which in this case would be at http://external.facebook.com/apps/my_movie_app) with the FBML.registerCustomTags method, passing it the name of the tag, and the FBML markup to replace the tag with when it is encountered on the page. In this case, and based on the wiki documentation we’ll call that tag, . Your code on your page (or other developers’ pages that use your code) will look like this:

Through this simple method, Facebook has provided an easy way for Facebook developers to share their code, in a nice, compartmentalized way. It also makes it very easy to re-use developers’ code across applications and throughout developers’ apps. Facebook says this is only for Facebook Apps, and does not yet support Facebook Connect or third-party sites, but they do have plan to support such. As more details emerge I’ll update you here, or on LouisGray.com. In the meantime, check out my book on FBML, FBML Essentials to learn more about developing with Facebooks FBML Tag language.