2012-04-24 6 views
-1

안녕하세요 여러분, 버튼과 관련하여 문제가 있습니다. 나는 https://developers.facebook.com/docs/reference/plugins/like/의 모든 단계를 따라 갔다. js.src에 "https"를 추가하는 것을 포함하여 그물에서 발견 한 몇 가지 솔루션을 적용했습니다. 코드는 아래에서 볼 수 있습니다. 여러분이 저를 도울 수 있기를 바랍니다. ^^버튼이 보이지 않는 XFBML

<html 
    xmlns = "http://www.w3.org/1999/xhtml" 
    xmlns:og = "http://ogp.me/ns#" 
    xmlns:fb="http://ogp.me/ns/fb#"> 

    <?php 
     $title = "This is a Title."; 
     $type = "movie"; 
     $url = "http://www.200909630.site11.com/share.php"; 
     $image = "http://i3.kym-cdn.com/photos/images/original/000/264/615/242.png"; 
     $description = "This is a description."; 
    ?>   

    <head> 
     <title>Fund My Travel</title> 
     <meta property = "og:title" name = "title" content = "<?php echo $title; ?>" /> 
     <meta property = "og:type" name = "type" content = "<?php echo $type; ?>" /> 
     <meta property = "og:url" name = "url" content = "<?php echo $url; ?>" /> 
     <meta property = "og:image" name = "image" content = "<?php echo $image;; ?>" /> 
     <meta property = "og:description" name = "description" content = "<?php echo $description; ?>" /> 
     <script type = "text/javascript" src = "http://static.ak.fbcdn.net/connect.php/js/FB.Share"></script> 
     <script type = "text/javascript"> 
      var buttons = document.getElementsByName('fb_share'); 
      var count = buttons.length; 
      for(var i = 0; i<count; i++) { 
       var data = FB.Share.getUrl(buttons[i]); 
       if(FB.Share.results[data]) { 
        buttons[i].fb_count = FB.Share.results[data].total_count; 
       } 
       FB.Share.displayBox(buttons[i], 0); 
      } 
     </script> 
     <script> 
      !function(d, s, id) { 
       var js, fjs = d.getElementsByTagName(s)[0]; 
       if(!d.getElementById(id)) { 
        js = d.createElement(s); 
        js.id = id; 
        js.src = "//platform.twitter.com/widgets.js"; 
        fjs.parentNode.insertBefore(js, fjs); 
       } 
      } 
      (document, "script", "twitter-wjs"); 
     </script> 
     <script type="text/javascript"> 
      window.___gcfg = {lang: 'en-GB'}; 
      (function() { 
       var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; 
       po.src = 'https://apis.google.com/js/plusone.js'; 
       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 
      })(); 
     </script> 
    </head> 
    <body> 
     <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"; 
       fjs.parentNode.insertBefore(js, fjs); 
      }(document, 'script', 'facebook-jssdk')); 
     </script> 

     <table cellspacing = "3" cellpadding = "3"> 
      <tr> 
       <fb:like send = "false" width = "450" show_faces = "false"></fb:like> 
      </tr> 
      <tr> 
       <td> 
        <a name = "fb_share"></a> 
       </td> 
       <td> 
        <a href = "https://twitter.com/share" class = "twitter-share-button" data-lang = "en" 
         data-url = "<?php echo $url; ?>" data-text = "<?php echo $title; ?>"></a> 
       </td> 
       <td> 
        <g:plusone size = "medium"></g:plusone> 
       </td> 
      </tr> 
     </table> 
    </body> 
</html> 
+1

가 지원 옵션에 대해 공급 업체에 문의하시기 바랍니다 자사의 자바 스크립트 SDK 머리 태그에이를 추가 할 수 있습니다. – hakre

+0

@ hakre : 실제로 FB에는 지원에 대한 의견이 있습니다. -S http://blog.stackoverflow.com/2011/08/facebook-stackoverflow/ – zerkms

+0

죄송하지만 저는 웹 개발에서 그다지 진보하지 않았습니다. 답을 다시 말해 주시겠습니까? 큰 감사를 드린다.^ –

답변

0
<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"; 
fjs.parentNode.insertBefore(js, fjs); 
}(document, 'script', 'facebook-jssdk'));</script> 
initialize this script after body tag not before than, than put this div where you want that button and inser your url of page to like in data-href . 
<div class="fb-like" data-href="http://stackoverflow.com/questions/10293545/strange-  error-headers-already-sent-by-output-started-at" data-send="true" data-width="450" data-show-faces="true"></div> 
+0

태그 다음에 오는 것을 의미합니까? ^^ –

+0

시작 이후에 태그 –

+0

. 여전히 작동하지 않습니다. T_T –

0
<script> 
    window.fbAsyncInit = function() { 
    FB.init({ 
    appId  : 'YOUR_APP_ID', // App ID 
    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File 
    status  : true, // check login status 
    cookie  : true, // enable cookies to allow the server to access the session 
    xfbml  : true // parse XFBML 
}); 

// Additional initialization code here 
}; 

    // Load the SDK Asynchronously 
    (function(d){ 
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; 
if (d.getElementById(id)) {return;} 
js = d.createElement('script'); js.id = id; js.async = true; 
js.src = "//connect.facebook.net/en_US/all.js"; 
ref.parentNode.insertBefore(js, ref); 
}(document)); 
</script> 

시도는

+0

은 appId와 chanelUrl이 필요합니까? ^^ –

+0

처음에는 작동하지 않았지만 js.src에 "https"를 추가 한 후 작동했지만 fb_admin 메타 태그에 대한 오류가 발생했습니다. 또 다른 오류, 1 실행 후 같은 버튼이 다시 표시되지 않습니다. T_T –

+1

channnel url은 필요하지 않지만 페이스 북에서 앱을 만들어야 거기에서 앱 ID를 얻습니다. –

관련 문제