简体   繁体   English

用户想要将链接发布到他们的Facebook墙上

[英]User wants to post link to their facebook wall

Our early users want to post links to their artifacts onto their facebook wall. 我们的早期用户希望将其工件的链接发布到其Facebook墙上。 Not something we put in the beta version. 我们在Beta版本中没有添加任何内容。

This site lets users post photos and descriptions (artifacts from antiquity) and instead of referring people to our site they prefer posting a link to their 2nd century bc ornaments' photos onto their facebook wall. 该网站允许用户发布照片和描述(古代的人工制品),而不是向人们介绍我们的网站,他们更喜欢在其Facebook墙上张贴指向其2世纪bc饰品照片的链接。

I will add a button 'FB' on our site -- they click the button and (somehow) a 'log in to facebook' window appears so they can immediately put the link on our site of their antique onto their wall. 我将在我们的网站上添加一个按钮“ FB”-他们单击该按钮,并(以某种方式)出现“登录到Facebook”窗口,以便他们可以立即将其古董网站上的链接放置在墙上。

I have studied this on SO and read posts on 'share,' 'like,' the FB sdk docs, the 'graph api', but it all seems like not what I need to do, which is simple -- add a FB button on our site that when clicked lets them log on to their Facebook account so they can put the link on their wall. 我已经在SO上进行了研究,并阅读了“分享”,“喜欢” FB sdk文档,“ graph api”上的帖子,但这似乎不是我需要做的,这很简单-添加FB按钮在我们的网站上,单击可让他们登录自己的Facebook帐户,以便他们可以将链接放在他们的墙上。

Surely this is a solved problem -- or is it? 当然这是一个已解决的问题-是吗?

You do want to use the FB API's Share button. 您确实要使用FB API的“共享”按钮。

https://developers.facebook.com/docs/share/ https://developers.facebook.com/docs/share/

Specifically, you'll want a button like: 具体来说,您需要一个类似以下的按钮:

<a name="fb_share"
    url="<?php echo "//" + $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>"
></a> 
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

[Edit] As discussed in the comments, Share is deprecated. [编辑]如评论中所述,不建议使用共享。 Here is the like code: 这是类似的代码:

<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&appId=<?php echo $APP_ID; ?>";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like"
    data-href="<?php echo "//" + $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; ?>"
    data-send="true" data-width="450" data-show-faces="true"></div>

And on closer examination, this is the code I'm currently using on my content network; 仔细检查一下,这就是我当前在内容网络上使用的代码; I'd forgotten this was the new version. 我忘了这是新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM