나는 굉장하고 잘 작동하는 Nick Baker 's (webtechnick) CakePHP/Facebook 플러그인을 사용하고 있습니다. 그러나 나는 대답 할 수 없을만큼 의문이 있습니다.Cakephp Facebook 플러그인 - 액션을 통해 공유
조치를 통해 공유 버튼 사용을 직접 무시하고 공유하려면 어떻게해야합니까?
예를 들어 사이트를 통해 게시물을 만들고 게시물을 DB에 추가하고 작업을 통해 로그인 한 사용자의 Twitter 계정에 게시물을 촬영합니다. 이 작업을 FB 계정에 공유 처리하려면 어떻게해야합니까? (이미 연결되었습니다.) 나는 누군가가 명백하게 행동에서 직접 $ this-> Facebook-> share()를 시도 할 것이라고 생각한 첫 번째 것을 시도했다. 아무런 쓸모가 없었다. ...
어떤 생각이나 해결책이 큰 도움이 될 것이다.
애프터 서비스 후 업데이트
Thx for the help spooney. 나는 당신이 내가 말할 수있는 것에서 100 % 자리를 지키기 때문에 당신의 답을 뽑았습니다. JS SDK를로드 중입니다.
function init($options = null, $reload = true) {
if (empty($options)) {
$options = array();
}
if ($appId = FacebookInfo::getConfig('appId')) {
$session = json_encode($this->Session->read('FB.Session'));
if ($reload) {
$callback = "FB.Event.subscribe('auth.login',function(){window.location.reload()});";
} else {
$callback = "if(typeof(facebookReady)=='function'){facebookReady()}";
}
$callback .= "FB.Event.subscribe('auth.logout',function() {window.location = '/bastards/users/logout'});";
$init = '<div id="fb-root"></div>';
$init .= $this->Html->scriptBlock(
<<<JS
window.fbAsyncInit = function() {
FB.init({
appId : '{$appId}',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true // use Oauth
});
{$callback}
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/{$this->locale}/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
JS
, $options);
return $init;
} else {
return "<span class='error'>No Facebook configuration detected. Please add the facebook configuration file to your config folder.</span>";
}
}
나는 아무 문제가 사용자 정보를 당기고 모든 작업이 없습니다. ...
<a href="#" onClick="publishStory();" class="sendFeed"><br><font style="color:#FFF; text-decoration:none;padding-left:27px;">post to wall</font></a><br>
<script>
function publishStory() {
var body = 'Reading JS SDK documentation';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Post ID: ' + response.id);
}
});
}
</script>
내 사이트에서 FB에 게시 달성했다,하지만 난에 위의 코드를 교체 시도
<a href="#" onClick="publishStory();" class="sendFeed"><br><font style="color:#FFF; text-decoration:none;padding-left:27px;">post to wall</font></a><br>
<script>
function publishStory() {
FB.ui({
method: 'feed',
name: 'message name',
caption: 'message caption ',
description: 'description goes here',
link: 'the url current page',
picture: 'if you want to add an image'
},
function(response) {
console.log('publishStory response: ', response);
});
return false;
}
</script>
는 ... FB.ui를 사용하여 링크를 통해서만이었다 그러나 매번 오류가 발생합니다.
사용자 FB 벽의 게시물이 실제로 사이트의 persay에서 오는 것이 아니라면, 벽에서 사용자가 보낸 게시물인데 기본적으로 "나는 ladala.com에 게시물을 작성했습니다. , 당신은 그것을 조사해야한다. "
이제 게시를 제출하는 작업을 통해 FB.ui를 실행하는 방법을 알아야합니다.
JS SDK는 이러한 종류의 기능을 지원합니다. 가능성을 사용하고 있습니까? –
완전히 정직한 spoony이기 위하여 나는 모른다 ... 당신은 말하고있다, http://developers.facebook.com/docs/reference/javascript/, 정확합니까? –
예. JS SDK를 사용하여 사람들이 읽은 기사 나 시청 한 동영상, 구현하기가 매우 쉬운 API와 같은 API를 호출 할 수 있습니다. 사용자에게 벽에 물건을 공유하도록 사용자에게 요청할 수도 있습니다 (http://developers.facebook.com/docs/reference/javascript/FB.ui/) (https://developers.facebook.com/docs/reference/ 대화 상자/피드 /). 나는 이것이 당신이 찾고있는 것이거나, 당신의 응용 프로그램에 구현하는 것이 합리적인지 확실하지 않습니다. –