2012-11-28 18 views
0

我已經搜索並通過了許多所謂的解決方案,但沒有任何幫助。 我有一個情況,我需要不同的li標籤在同一頁上的多個Facebook評論。單個頁面中的多個Facebook註釋插件

該代碼將使我想清楚。

<?php foreach($events_without_upcoming as $single_events):?> 
    <li id="event_<?php echo $single_events->id; ?>" class="events" style="cursor:default"> 
     <span class="sn"><?php $i++; ?></span> 
     <span class="date"><?php echo $new_date?></span> 
     <span class="venue"><?php echo $single_events->venue; ?></span> 
     <span class="address"><?php echo $single_events->address; ?></span> 
     <span class="option"><?php echo share_button('facebook', array('url'=>"http://www.xxxxxx.com", 'text'=>$text))?><?php echo share_button('twitter', array('url'=>$url, 'text'=>$text, 'via'=>'Lightning At The Opera', 'type'=>'iframe'))?></span> 
     <div id="fb_<?php echo $single_events->id; ?>" class="fb_plugin" style="display:none;"></div> 
     <div class="fb-like" style="display:block" data-href="http://www.xxxxxx.com/<?php echo $single_events->id; ?>" data-send="true" data-width="450" data-show-faces="false"></div> 
     <div class="fb-comments" data-href="http://www.xxxxxx.com/#event<?php echo $single_events->id;?>" data-width="470"></div>    
    </li> 
    <?php endforeach;?> 

FB註釋插件位於foreach循環中。 每個li包含評論插件。 我試着給代碼中的data-href一個唯一的url,但它不工作。 我一直在嘗試從早上,但我找不到任何東西。

如果我沒有讓自己清楚,請問任何需要的東西。

Thx提前。

+0

我們可以擁有真實的代碼,而不是它的破損版本嗎?我可以隱約地告訴它,這是PHP。 –

+0

sory爲模糊的代碼...我編輯它。 –

回答

1
<iframe 
style="border: none; overflow: hidden; height: 155px; width: 470px;" 
scrolling="no" 
src="https://www.facebook.com/plugins/comments.php?api_key=your_api_key&elation%3Dparent.parent&numposts=1&width=470&href=http%3A%2F%2Fexample.com"></iframe> 

,因爲我們無法找到與JS所以我們用IFRAME沒有任何JS庫的任何解決方案,

也有幫助,當我們要動態地顯示評論。