从 Facebook 评论框中检索评论计数
我在网站上使用
,但我不知道如何从具有特定 XID 的评论框中检索评论计数。
我尝试使用以下代码拦截所有新评论:
FB.Event.subscribe('comments.add', function(response) { alert("评论已添加。"); });
但我从未收到过警报。有什么想法吗?我只需要任何给定框的评论数量。
I use <fb:comments>
on my website, but I can't figure out how to retrieve the comment count from a comment box with a specific XID.
I've tried intercepting all new comments with the following code:
FB.Event.subscribe('comments.add', function(response) {
alert("Comment was added.");
});
I never receive the alert though. Any ideas? I just need the number of comments for any given box.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您可以使用这个简单的 Facebook 标签来获取评论数:
You can get the count of your comments with this simple fb tag:
您应该能够从
link_stat 获取
表。comment_count
字段通过 FQL 提供带有评论插件的页面的url
如果这不起作用,您还可以从
comment
表中获取xid
的所有评论,然后自己计算它们(FQL 不支持COUNT
)。但返回的记录数量有限制,因此很可能只会返回前 5,000 条评论。You should be able to get
comment_count
field fromlink_stat
table through FQL by providingurl
of a page with your comment plugin.If that doesn't work you can also get all comments by
xid
fromcomment
table and then count them yourself (FQL doesn't supportCOUNT
). But there is a limit on returned number of records, so most likely it would return only first 5,000 comments.我找了好久的答案,终于找到了。
保存后即可阅读评论。
你可以看到:
Guardar 评论 facebook
I was finding the answer a lot of time, and finally i found it.
You can read comments when it is saved.
You can see:
Guardar comentarios facebook
您在问两个不同的问题。 1) 如何获取评论计数,2) 如何使用 JavaScript 跟踪评论事件。对于 2,您需要注释标记包含 notification="true" 才能触发事件。
You are asking two separate questions. 1) how to get a count of comments, and 2) how to track the comment event with JavaScript. For 2, you need the comment tag to include notify="true" in order for the event to be fired.
此代码对我有用
items[0].comments 就是您要查找的内容
this code is working for me
items[0].comments is what you are looking for