treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Blogger + Facebook Comment Count

  • Hi there I would like combine the number of comment received on a Page via Blogger Comment System and Facebook Comment System.

    So if I have received 2 Comments from Facebook and 3 comments from Blogger ,Then In the Post Header I want to show the Comment Count as 5 Comments (Total of Both)

    I am newbie to this stuff , is this possible, Please help
  • Please Help anybody out there



  • you should look on the Facebook developers's page.
    or ask that on Stack Overflow.
  • You can get the Blogger comments total via param.feed.openSearch$totalResults.$t
    I don't know about Facebook.

    <div id="num"></div>
    <script>
    function getCommentTotal(json) {
    var currNotif = parseInt(json.feed.openSearch$totalResults.$t, 10);
    document.getElementById('num').innerHTML = currNotif;
    }
    var s = document.createElement('script');
    s.id = "cm";
    s.src = "http://latitudu.blogspot.com/feeds/comments/summary?redirect=false&alt=json-in-script&max-result=0&callback=getCommentTotal";
    document.getElementsByTagName('head')[0].appendChild(s);
    // Total comments = Blogger + Facebook
    document.getElementById('cm').onload = function () {
    var count_1 = parseInt(document.getElementById('num').innerHTML, 10),
    count_2 = 10; // Example value => From facebook feed (How? I don't know! T_T)
    document.getElementById('num').innerHTML = (count_1 + count_2);
    }
    </script>


    EDIT: Ops. I guess what you mean is trying to make a notification comment, Sorry. This is not the part of the solution T_T.