Monday, March 27, 2017

How to use facebook comment ,like,share buttons or plugins dynamically?


Hello Guys!
This tutorial is about plugins of facebook. As we all know that facebook have made us soo easy to use its share,like button and coment plugin etc for developer.
Any one can use this by copying soo easily bt its some tricky too use it dynamically.
Today, in this tutorial , i am going to show you how I have used it dynamically.
First go to this website of facebook for developer to use its plugins and like button , share,send etc.facebook for developer.
Now, just grab the codes from there of coment,share , like plugins and paste it where to in your website.
I have used it like this  giving link on 9,12 line as like this using link id "http://onlinestudy.bramento.com/pages/detail.php?post_id=<?php echo($row['post_id']); ?>
  1.  <div id="fb-root"></div> 
  2.             <script>(function(d, s, id) {
  3.   var js, fjs = d.getElementsByTagName(s)[0];
  4.   if (d.getElementById(id)) return;
  5.   js = d.createElement(s); js.id = id;
  6.   js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.8";
  7.   fjs.parentNode.insertBefore(js, fjs);
  8. }(document, 'script', 'facebook-jssdk'));</script>         
  9.     <div class="fb-like" data-href="http://onlinestudy.bramento.com/pages/detail.php?post_id=<?php echo($row['post_id']); ?>" data-layout="button_count" data-action="like" data-size="large" data-show-faces="true"></div>&nbsp<div class="fb-send" data-href="http://onlinestudy.bramento.com/pages/detail.php?post_id=<?php echo($row['post_id']); ?>"></div>
  10.     
  11.     <br />
  12.     <div class="fb-comments" data-href="http://onlinestudy.bramento.com/pages/detail.php?post_id=<?php echo($row['post_id']); ?>" data-numposts="5"></div>

No comments:

Post a Comment