Fb:fbml

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

This tag serves two purposes. You can use this tag to:

  1. Define a block of FBML to be rendered in a specific version of FBML.
  2. Define a namespace to use with Custom Tags.

When using this tag with custom tags, the xmlns attribute defines a namespace for the custom tags registered by an application. Adding an xmlns attribute effectively imports the custom tags from an application into a namespace of your choice within the scope of the fb:fbml tag.

The value of the xmlns attribute must be a URL of the form "http://external.facebook.com/apps/<app_name>". The <app_name> must match the name of the registering application's name in the application's canvas URL (that is, "http://apps.facebook.com/<app_name>").

Inside fb:fbml, you can use any custom tags you registered for your application using fbml.registerCustomTags by prefixing those tags with the namespace you selected (see Examples below).

An fb:fbml tag may have more than one xmlns property, each of which defines a different namespace.

Note: You cannot create a namespace that starts with fb or f8. This keeps the Facebook FBML namespace distinct from any custom namespace.

Attributes

RequiredNameTypeDescription
optional version float The version of FBML with which to render the content. (Default value is [the current version].)
xmlns string The name of the custom tag namespace. You cannot create a namespace that starts with fb or f8. You can include alphanumeric characters, underscores ("_"), and hyphens ("-"). Note: You can include multiple xmlns attributes in one fb:fbml tag.

Examples

<fb:fbml version="1.0"> The tags that follow rely completely on FBML in version 1.0. This is being rendered in version: <fb:fbmlversion /> </fb:fbml>


<fb:fbml version="1.2"> The tags here rely on FBML 1.2. This is being rendered in version: <fb:fbmlversion /> </fb:fbml>
picture2nc4.png


In this Custom Tags example, we (the tags consumer) imported custom tags defined by the tag creator "my_movie_app" into the namespace "movies".

<fb:fbml xmlns:movies="http://external.facebook.com/apps/my_movie_app"> <movies:gallery title="my movie gallery"> <movies:video id="7" /> </movies:gallery> </fb:fbml>

See Also

reference