2012-05-24 51 views
0

我的應用程序顯示幾個項目,用戶可以搜索。我想爲每個項目放置一個類似的按鈕,這將使用PHP自動生成。在實現它之前,我試圖測試一些不起作用的東西。創建自定義Facebook Like按鈕爲每個項目

<div class="fb-like" data-href="http://www.example.com/index.php?item=1" data-send="true" data-width="450" data-show-faces="true"></div> 

當我把它放在頁面上,Facebook的按鈕沒有出現,任何想法?

回答

0

好吧,我已經成功地解決它,

確保放置這些代碼吹聲明後<div class="fb-like" data-href="http://www.example.com/index.php?item=1" data-send="true" data-width="450" data-show-faces="true"></div>

<script src="http://connect.facebook.net/en_US/all.js"></script> 
<script> 
    FB.init({ 
    status : true, // check login status 
    cookie : true, // enable cookies to allow the server to access the session 
    xfbml : true // parse XFBML 
    }); 
</script>