Friday, February 8, 2013

Multiple Facebook like button in a single page / URL using PHP

Follow the below steps one by one..

1) In Details of a product page :

Inside the head tag:

<meta property="og:title" content="<?=$product_title?>"/>
<meta property="og:type" content="product"/>
<meta property="og:url" content="<?=$SITE_URL?>product_detail.php?productid=<?=$product_id?>"/>
<? if($upload_image != '') { ?>
<meta property="og:image" content="<?=$SITE_URL?>products/thumb/<?=$upload_image?>"/>
<? } else { ?>
<meta property="og:image" content="<?=$SITE_URL?>products/original/default.jpg"/>
<? } ?>
<meta property="og:site_name" content="<?=$SITE_URL?>"/>
<meta property="fb:admins" content="0000000000"/> <!-- 0000000000 - Replace with your Facebook profile ID (FBID) -->
<meta property="og:description" content="<?=$product_desc?>"/>

Inside the body tag (In required place):

<fb:like href="<?=$SITE_URL?>product_detail.php?productid=<?=$product_id?>" layout="button_count" show_faces="false" width="240" height="40" action="like" colorscheme="light"></fb:like>

2) In the List page (All products listed with short description and details page link) :


Inside the body tag (In required place):  


<fb:like style="top:-3px" colorscheme="light" action="like" show_faces="false" layout="button_count" href="<?=$SITE_URL?>product_detail.php?productid=<?=$product_id?>" fb-xfbml-state="rendered" class="fb_edge_widget_with_comment fb_iframe_widget"><span style="height: 20px; width: 74px;"><iframe scrolling="no" id="f3b003f3c8bca78" name="f3b36b728edb6bc" style="border: medium none; overflow: hidden; height: 20px; width: 74px;" title="Like this content on Facebook." class="fb_ltr" src="http://www.facebook.com/plugins/like.php?api_key=000000000000000&amp;locale=en_US&amp;sdk=joey&amp;channel_url=<?=$SITE_URL?>product_detail.php?productid=<?=$product_id?>&amp;href=<?=$SITE_URL?>product_detail.php?productid=<?=$product_id?>&amp;node_type=link&amp;width=90&amp;layout=button_count&amp;colorscheme=light&amp;action=like&amp;show_faces=false&amp;extended_social_context=false"></iframe></span></fb:like>

<!--000000000000000 - Replace with your Facebook APPID. First you must create Facebook Apps. Then they given the Facebook APPID-->

After that do the required changes like SITE_URL, product_title, upload_image, product_desc, product_id, productid, AppID, FBID etc.

Now Your website is ready for use. :-)

No comments:

Post a Comment