Facebook Cookbook - Jay Goldman [80]
which will give you something like Figure 6-36.
Figure 6-36. The simplest form of fb:board
NOTE
You might consider using a Wall post–type comments system instead of a discussion board, depending on whether you want a conversation or more of a one-way message board. See Giving Users a Voice: Wall Posts in Your App. Note that the implementation of both tags is almost identical, so you might have a striking sense of déja vu if you’ve already read that recipe.
Discussion
The xid parameter needs to be unique, so go nuts and make up something that no one else will have thought of. You’re limited to alphanumeric characters (Aa–Zz, 0–9), hyphens (-), and underscores (_). You’ll see why it needs to be unique once you have the board on your page and you can see the URLs it uses for internal pages, which all point back to the same set of PHP pages for every board, passing in your xid to identify which board it should load content for.
You can control the number of topics that appear in the initial view by passing in a numtopics parameter (which defaults to 3):
Four optional parameters control permission for the current user: canpost, candelete, canmark, and cancreatetopic. Other than candelete (which defaults to false for obvious security reasons), they all default to true. The only one that isn’t immediately obvious from its name is canmark. You might think this means they can mark things as favorites, but it actually enables or disables the ability to mark posts as relevant or irrelevant.
The last two options give you control over the URLs used by the board. Both default to the current page, but you can choose to load a configuration from a different URL by specifying a callbackurl, or to have people pop out of the discussion boards onto a different page by specifying a returnurl. The documentation for fb:board warns that every page load within the board will reload the configuration, so you should consider using the callbackurl to point Facebook to a page that is served from a potentially lower-cost or higher-bandwidth/reliability server, just in case hundreds of thousands of users storm down your door to talk about their favorite adolescent magicians.
Finally, you can specify your own title for your board by throwing an fb:title tag into the fb:board:
canpost="true" candelete="false" canmark="false" cancreatetopic="true" callbackurl="http://superrobustserver.com/board_config.php" returnurl="http://apps.facebook.com/potterchatter">
Keep in mind that this feature is still marked as beta, so it might behave a little differently than you’re expecting it to. If you run into any problems, jump into the Facebook Bug Tracker (http://bugs.developers.facebook.com/) and post about them so that the Facebook team can get right on fixing them.
Giving Users a Voice: Wall Posts in Your App
Problem
I’d really like to have something like the Profile Wall in my app so that users can leave comments.
Solution
Don’t settle for something like the Wall; have the Wall! Use the fb:comments tag to add a real, live Wall to your Canvas pages. The simplest form is:
which will give you something like Figure 6-37.
Figure 6-37. The simplest form of fb:comments
NOTE
You might consider using a Discussion Board–type system instead of a Wall, depending on whether you want a one-way message board or more of a conversation. See Discussion Boards Made Simple. The implementation of both tags is virtually identical, so this might all seem very familiar if you’ve already read that recipe.
You could also use the fb:wall