Facebook Cookbook - Jay Goldman [73]
height
int
None
Height of your Silverlight, in pixels.
imgclass
string
None
CSS class to apply to the image specified in imgsrc.
imgsrc
string
spacer.gif
The image that will be shown in place of your Silverlight when it can’t be displayed or in places where the user needs to click to activate it (e.g., in Profile Boxes). The default value is http://static.ak.facebook.com/images/spacer.gif, which will render your Silverlight unusable in Profile Boxes since it will be invisible, so make sure you specify this if you want to embed it there.
imgstyle
string
None
Inline CSS styling for the image specified in imgsrc.
swfbgcolor
string
#ffffff
According to the Facebook Developers Wiki, that is the correct name for the parameter, even though it’s not a SWF. The attribute doesn’t appear to do anything either way.
width
int
None
Width of your Silverlight, in pixels.
The FBML parser will embed your image in a div with the id silverlightImage and your actual Silverlight in a div with the id silverlightControlHost. Since both of those are IDs rather than classes, it suggests that you can embed only one Silverlight movie per Facebook page. It’s so early in the wild Silverlight frontier that it’s hard to say whether anyone has used this tag in production, so keep that in mind when you’re choosing a technology for your interactive media bits.
Wide Versus Narrow Profile Boxes
Problem
I know users can drag my Profile Box from the wide body of their Boxes tab into the narrow sidebar, and I’d really like to be able to display different content when they do. How can I send different info to Facebook?
Solution
Facebook provides two tags that differentiate where the content should be shown: fb:wide and fb:narrow. It will be left as a task for the reader (that would be you) to determine which is which. There are no parameters for either tag.
Note that these tags aren’t used on a Canvas page in the same way as many of the other tags in this chapter. You’ll need to pass your FBML as a parameter to the Facebook API’s Profile.setFBML() method, which will update the cached Profile Box for the specified user. For more information, see Getting and Setting Profile FBML.
Discussion
If you call the Facebook API’s Profile.setFBML() and don’t pass in fb:wide or fb:narrow tags, everything you do pass in will be placed in both locations. Neither box has a height constraint, so you’re free to make your content as tall as you’d like (though keep in mind that people are more likely to remove your box if it takes over their entire Profile). The wide box is 388 pixels wide with an 8-pixel left margin and no right margin, so if you want them to be balanced, go for a width of 380 pixels. The narrow box is 190 pixels wide, with a left margin of 10 pixels and no right margin, so go with 180 pixels if you want balanced margins.
Don’t forget that there are settings for your application that will determine whether you end up in the sidebar or body by default (“Default Profile Box Column: Wide or Narrow”), as well as what default FBML to display in the Profile Box before the user has done anything in your application (“Default FBML”). For more information on setting these, see Setting Up a New App.
Tabling Users
Problem
I love the Mutual Friends table of users I see on people’s Profile pages, and I’d really like to display a similar listing of users in my app.
Solution
The good news is that you can use the fb:user-table tag to display a table of users without worrying about the formatting and extra HTML. The bad news is that it will only work in a Profile Box and can’t be used in a Canvas page. The simplest form is:
That’ll give you an awesome table filled with links to my Profile; see Figure 6-10.
Figure 6-10. User table filled with