Reference Guide

facebook FBML Reference Guide Page 83 of 159
Message/Wall attachments
Fb:attachment-preview
Description
Renders a link in a wall or message attachment that, when clicked, replaces that attachment with newly fetched
content. The URL from which the content is fetched is a hidden input in the current content, and all other inputs
in the content are posted.
This article or section needs expansion
Attributes
Examples
This is a basic outline of how to setup attachments.
Basically, set the Attachment callback URL to some page on your server. For instance
http://yourserver.com/attach.php
attach.php will handle both the attachments, and the selection of the attachments.
<?php
if ($_POST['message_sent'] < 1)
{
// The user is selecting the attachment, in other words, preview mode
// Print out form elements that allow the user to select the attachment
echo '<fb:editor-text label="Sample" name="sample" value="'
. htmlspecialchars($_POST['sample']) . '"/>';
// The following line tells facebook to use the same script for attachments
echo '<input type="hidden" name="url" value="http://yourserver.com/attach.php" />';
// The following line lets your user preview the attachment they've selected
echo "<fb:attachment-preview>Click here to preview attachment</fb:attachment-preview><br /><br />";
echo "<b>Preview:</b>";
echo "<hr />";
}
else
{
// Do anything here you want to do for attached objects only
echo "(The object is attached)<br/><br/>";
}
// Display your attachment here. This will show up both for preview and live attachments
echo "you wrote <b>" . htmlspecialchars($_POST['sample']) . "</b><br />";
?>
www.yapish.com