自分のデータベースでlivefyreの コメント数を取得して、記事をコメント数で並べ替えたいと考えています。
私のサイトでページが読まれるたびに、特定のページのコメント数を Livefyre に問い合わせ、その数でデータベースを更新したいと考えています。
ページのソースを取得しようとしましたが、役に立たないようです。
助言がありますか?
自分のデータベースでlivefyreの コメント数を取得して、記事をコメント数で並べ替えたいと考えています。
私のサイトでページが読まれるたびに、特定のページのコメント数を Livefyre に問い合わせ、その数でデータベースを更新したいと考えています。
ページのソースを取得しようとしましたが、役に立たないようです。
助言がありますか?
Atish の答えは、ページ上の JavaScript にコメント数を通知するための最良の方法として正しいため、クライアント側の分析を介して追跡したり、カウントがレンダリングされるページ上の別の場所を更新したりできます。
サーバー側から、会話の「init」リクエストを使用して、パブリック コメント数を取得できます。
numVisible
)最後に、Livefyre アクティビティ ストリーム API を使用して、コミュニティ アクティビティのリアルタイム ファイアホースを取得できます。これを使用して、カウントを最新の状態に保つことができます。
ここで Livefyre コメントのカスタム実装を確認してください
https://github.com/Livefyre/livefyre-docs/wiki
電話すると
fyre.conv.load({"network": self.network,
authDelegate: self.authDelegate
}, [ self.config ], self.lfready)
self.lfready でコールバック イベントを渡す必要があります。
app.on('commentCountUpdated', self.onCommentCountUpdated);
この「commentCountUpdated」は、コメント数を返す livefyre コールバック イベントです。
self.lfready = function(app) {
//Wrap in try catch because Livefyre catches errors in the callback (seemingly)
//And we want to catch and log ourselves.
try{
$.log("Livefyre is ready, attaching custom handlers");
//Attach events
app.on('commentCountUpdated', self.onCommentCountUpdated);
//Only update to zero if the onCommentCount hasn't fired already
self.$commentContainer.find("#lf_comment_stream").show();
}catch(err){
$.error("Livefyre failed to load", err);
self.$commentContainer.hide();
}
};
self.onCommentCountUpdated = function(number){
console.log("Latest count from LF stream event:" + number)
};