2012-07-28 40 views
0

我想在「forumeiros」上的所有帖子上做一個Like按鈕(免費論壇)
當我在帖子上按下「Like」按鈕時,它像所有隨機發帖一樣,任何意義,我
使用下面的代碼來生成按鈕:
Facebook喜歡的按鈕太多了

jQuery(document).ready(function() { 
    var url = new Array(); 
    var link = ''; 
    jQuery('.postbody .topic-title a[name]').each(function(index){ 
     link = "http://"+document.domain+jQuery(this).attr("href")+"/"; 
     link = link.replace('#', '/t'); 
     url.push(link); 
    }); 
    jQuery('p.author').each(function(index){ 
     jQuery(this).after('<iframe src="http://www.facebook.com/plugins/like.php?href='+url[index]+'&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=55" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:24px;" allowTransparency="true"></iframe><hr> '); 
    }); 
}); 

這裏有兩個生成的鏈接:
http%3A%2F%2Fgmbrdebug-t.forumeiros.com%2Ft2-teste-teste%2Ft2%2F
http%3A%2F%2Fgmbrdebug-t.forumeiros.com%2Ft2-teste-teste%2Ft3%2F

解碼:(只顯示href屬性設置爲Facebook的IFRAME)

http://gmbrdebug-t.forumeiros.com/t2-teste-teste/t2/
http://gmbrdebug-t.forumeiros.com/t2-teste-teste/t3/

那麼,爲什麼當我按下第一個 「喜歡」 的所有下面是 「喜歡」 嗎?他們是不同的。

編輯: 所有的url重定向到相同的地方,可能是?
如果是,Theres沒辦法做到這一點?

回答

1

如果生成的鏈接重定向到相同的地方,那麼Facebook將它們視爲同一個圖形節點。這就是爲什麼喜歡一個人會喜歡他們的「全部」 - Facebook認爲他們只是一件事。

你需要的是爲每個帖子分開鏈接,並將這些鏈接用於Facebook的按鈕。