如何使用 Facebook FBJS Feed 表单
我正在尝试在 Facebook 应用程序中调用 Feed 表单,但不知道该怎么做。我不熟悉 FBJS 及其 API。具体来说,我需要显示以下对话:http://wiki.developers.facebook。 com/index.php/Feed_Forms
这是我现在得到的:
<script type="text/javascript">
var attachment = <?php echo json_encode($attachment); ?>;
return attachment;
Facebook.streamPublish(<?php echo $message; ?>, attachment, null, <?php echo $user; ?>);
</script>
为了正确调用 Feed 表单,我还需要做些什么吗?如果有人愿意写一个代码示例,那么它会对我有很大帮助。
I'm trying to call a Feed Form in my Facebook application and I'm not sure how to do so. I'm not familiar with the FBJS and its API. Specifically I need the following dialogue to show up: http://wiki.developers.facebook.com/index.php/Feed_Forms
Here's what I got for now:
<script type="text/javascript">
var attachment = <?php echo json_encode($attachment); ?>;
return attachment;
Facebook.streamPublish(<?php echo $message; ?>, attachment, null, <?php echo $user; ?>);
</script>
Is there anything else I need to do in order to properly call a Feed form? A code example would help me a lot if anyone is willing to write one up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下面是我在我运营的 Facebook Connect 网站上使用的示例:
FB.Connect
方法几乎与普通 JS 方法相同,因此类似的方法应该适合您。我想指出你有
作为
Facebook.streamPublish()
调用的第一个参数。假设 $message 是一个文本字符串,那么您需要将该输出用引号引起来,以使其成为有效的 Javascript。同样,returnattachment;
行对我来说没有多大意义。为什么那里有一个 return 语句?我会将你的代码更改为:Here's an example I use from a Facebook Connect site that I operate:
The
FB.Connect
methods are almost identical to the normal JS methods, so something similar should be working for you.I would point out that you have
<?php echo $message; ?>
as the first parameter to yourFacebook.streamPublish()
call. Assuming$message
is a text string, then you need to wrap that output in quotes in order for it to be valid Javascript. As well, thereturn attachment;
line doesn't make much sense to me. Why is there a return statement there? I would change your code to this:对于 FBML 画布页面,您所需要做的就是执行如下命令:
这应该可以轻松调出 Feed 表单。
For FBML canvas pages, all you need to do is execute the command as follows:
That should easily bring up the Feed Form.