0
votes

Yesterday I had some trouble with Facebook comment for Joomla 3.2.0. And for today i have to count the article's counts separately. So have the code from facebook but can't get the data-href right.

<span>Comments:<fb:comments-count data-href="<?=JURI::current()?>"></fb:comments-count></span>

So this data-href="<?=JURI::current()?>" is have to be changed i think. All articles have their own facebook comments so now i need is to have their own comment counting.

Question2: If there is no comment it's get just blank like Comments: ... so is there anyway to display non commented articles to have like Comments: 0.

1

1 Answers

0
votes

Try this,

https://api.facebook.com/restserver.php?method=links.getStats&urls=[URL]

You can use restserver.php for getting count of share,like,comment etc

 <?php
     $url = 'https://www.facebook.com/Walkswithme';
     $xml = simplexml_load_file("http://api.facebook.com/restserver.php?method=links.getStats&urls=".$url);
     $counts = $xml->link_stat->comment_count; 
   ?>

for more details

where you need the comment count just use like <?php echo $counts;?>

Hope its helps..