开发者

Like button for different pages

开发者 https://www.devze.com 2023-03-13 02:58 出处:网络
How to make facebook like button for different pages, I get button for site.com and i\'m in site.compage?product=1 - page and if somebody like the thing on that page, it will output to the post page

How to make facebook like button for different pages, I get button for site.com and i'm in

site.compage?product=1 - page and if somebody like the thing on that page, it will output to the post page in facebook that the person liked site.com, how to make that way so if user likes some page to开发者_JAVA百科 show the current page not the page that I added in the like button generator, so if user is on

site.com/page?product=2 and hit the like button , I want on his facebook page to have that he liked site.com/page?product=2 so every page on the site where is the button I want to be like that.


Use this jQuery plugin which makes it as easy as

jQuery('#fb-like').onefblike();


I use something like this... (along with the proper meta tags)

$url = "mysite/" . $_SERVER["REQUEST_URI"];
< iframe src="http://www.facebook.com/widgets/like.php?href=' . $url . >


You're a little confusing to be honest, do you mean the title of the page is what you want to appear in the Like?

Make sure you have this in your main HTML tag:

xmlns:fb="http://www.facebook.com/2008/fbml"

Go to your HEAD section and put in something like this:

<meta property="og:title" content="<?php echo $function_to_get_title; ?>" />
<meta property="og:site_name" content="site.com" />

If it's saying page not found or if FB is throwing up an error then check the link in the iFrame, use PHP:

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo curPageURL(); ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消