Number of IntenseDebate Comments

I just set up IntenseDebate on my blog this evening, and I am, for the most part, happy with it. One thing I saw was that they offered me a small snippet to show the current number of comments:

<script> var idcomments_acct = 'abcdefgef12345678mykey8675309acdc'; var idcomments_post_id; var idcomments_post_url; </script> <script type="text/javascript" src="http://www.intensedebate.com/js/genericLinkWrapperV2.js"></script> 

This is good, but I would like to do something similar to my archives page, which lists many messages, not just one. The page currently looks like this:

  • Some headlines
    Author's name
    A brief summary from this post ...

  • Some headlines
    Author's name
    A brief summary from this post ...

I would like it to look like this:

  • Some headlines
    Author's name
    A brief summary from this post ...
    7 Comments

  • Some headlines
    Author's name
    A brief summary from this post ...
    3 comments

But I'm not quite sure how I can do this with IntenseDebate. Do they offer any method for collecting the total number of comments for several pages from one page?

+4
source share
1 answer

I came up with a conceptual solution to my problem that involves using the IntenseDebate API and adding some server side scripts for the mix.

  • If your database does not currently store the number of comments for each entry, you must add a field for this. This number will be requested when displaying the main page containing all our latest posts.

  • We will want to write a small script that will live on the server and exist only to change the values โ€‹โ€‹of the comment counter for variables in our database. This can work by increasing any initial value by 1 or by completely accepting a completely new number.

  • We want to create a local javascript function that will asynchronously call the aforementioned server-side script, updating our database. We want to call this javascript function using the action hook provided in the IntenseDebate API. Each time a visitor posts a comment, the action hook calls our local Javascript function, which in turn will call our server-side function, which will update our database.

+1
source

Source: https://habr.com/ru/post/1308430/


All Articles