Reputation: 91
i am working on a website that is big into php databases i'm trying to get it so there is a (facebook)like button for every post that is made for the site. the only problem is the facebook likes are not individualized and are page specific so when i like 1 they all get liked. this would not be a problem if i could put each one in the comment section of the post since it is on a different page but each comment section is individualized by a php id variable that i pass to it (which does not actually change the url but only what shows up on the page). is there any way that i could make it so that each like button behaves on its own? here is the site i have been working on.
www.linkerbolt.com
Upvotes: 0
Views: 120
Reputation: 3206
In the div that you've created which contains the facebook like button, you can add a data-href property, and in this property you can add a link to whichever page you want :
data-href="www.whicheverpageyouwant.com"
In your case, you would need a different URL for each post. You can create a page that receives a post id and displays a single post (www.yoursite/posts/35) and set the data-href to point to each corresponding page when you have to display several on the same page.
Ficticious example :
<?php foreach ($forumPosts as $post) : ?>
<div class="fb-like"
data-href="wwww.yoursite/forumpost/<?php echo $post['id'];?>"
data-send="true"
data-width="450"
data-show-faces="true" />
<?php endforeach; ?>
Upvotes: 1