0

I'm trying to add facebook comments plugin to my flash games website for my game playing page and i have used this code for facebook comments form. The following code i have placed in play.php page.

<div class="fb-comments" data-href="http://www.dilawez.com/" data-num-posts="5" data-width="785"></div>

The following code i have placed in my index.php page just after my tag. The major issue with this code is i am able to see the comments for all my games. As i don't want to see like this. I want my users to post the comments for game wise. For example i have posted the comment for game 1, i am able to see for remaining games. Can anyone solve this isue.

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

For Demo see this link

2 Answers 2

0

Yes, you can do

Comments are specific to a page which is defined here data-href="http://www.dilawez.com/" so it an identifier to load comments or store them.

If you can put a unique URL for each game, it takes care automatically.

7
  • Hi venu, Thanks for response...but its not possible for my website. Because i have around 5000 games in my webiste. But i have only one page play.php.
    – youeye
    Jun 1, 2012 at 12:20
  • it is enough if the argument for that page changes.. eg: play.php?game=1 is different from play.php?game=2
    – Venu
    Jun 1, 2012 at 12:23
  • actually the thing is i have the url like this dilawez.com/play.php?id=1, so on..up to n. but i am changing this url with the help of .htacces file. because its a dynamic url and i am changing it to static like this dilawez.com/play/Spy_Truck
    – youeye
    Jun 1, 2012 at 12:38
  • Basically facebook needs an uniqe identifer to store comments data and when somebody posts on facebook, those will linked to that identifer. You can use that url which you refering as static (dilawez.com/play/Heavy_Pawnage) as indentifer
    – Venu
    Jun 1, 2012 at 12:47
  • hi venu, u can test it on live site..just before i have used one unique url data-href="dilawez.com/play/Spy_Truck" and i have posted with my facebook id but the same comment is appearing on all the games...u can see
    – youeye
    Jun 1, 2012 at 13:01
0

Use this following code to work properly...

<div class="fb-comments" data-href="<?php echo $confRow['sitePath'];?>play/<?php echo str_replace(' ','_',$gameInfoRow['name']);?>" data-num-posts="5" data-width="785"></div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.