Facebook评论框插件 [英] Facebook comment box plugin
问题描述
我正在使用Facebook评论框插件:
I am using Facebook comment box plugin:
<fb:comments href="${myPageUrl}" num_posts="20" width="630"></fb:comments>
一切正常.问题是我想将发布的评论存储到我的数据库中.有什么方法可以获取张贴在评论框上的文本.
Every thing is working fine. The problem is that I want to store the comment posted into my database. Is there any way to fetch the text posted on the comment box.
我正在使用以下js捕获comment-create
事件.
I am using the following js to catch comment-create
event.
FB.Event.subscribe('comment.create', function(response) {
alert(response.commentID)
});
我从中得到一些commentId
,但我不知道如何获取在特定comment-create
事件上发布的确切评论.
I'm getting some commentId
from this but I don't know how to fetch the exact comment posted on a particular comment-create
event.
推荐答案
Coomie:实际上,每当发表评论时,我都会通过'comment.create'捕获事件.我能够赶上该事件,但我想知道如何在该特定事件上发布评论(文本).类似于event.text或event.comment,但未找到直接方法
Coomie: Actually whenever a comment is posted, I catch the event thru 'comment.create'. I was able to catch the event but I was wondering how to get the comment(text) posted at that particular event. Like event.text or event.comment but there was no direct method found
因此,现在我用fql进行操作.这有点类似于您的示例.首先检索整个列表,然后选择顶部列表. 我的示例代码如下:
So, now I am manipulating it with fql. Which is somewhat similar to you example. First retrieving the whole list and then selecting the top one. My sample code is below:
FB.Event.subscribe('comment.create', function(response) {
FB.api({
method: 'fql.query',
query: "SELECT post_fbid, fromid, object_id, text, time from comment WHERE object_id in (select comments_fbid from link_stat where url ='${PageUrl}') order by time desc limit 1"
},
function(response) {
var feed = response[0];
alert(feed.text)
});
});
所以这种方法给我的结果与我想要的完全一样.
So this method is giving me exactly the same result I want.
这篇关于Facebook评论框插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!