2009-11-09 28 views
0

我正在使用定製的Jquery/PHP圖庫腳本,它從Flickr提要中提取圖像。 我試圖實現JQuery分頁插件,無濟於事。如何將JQuery分頁實現到自定義腳本中?

這裏是代碼...

<?php 

require_once('php/simplepie.inc'); 

$feed = new Simplepie('http://api.flickr.com/services/feeds /[email protected]&lang=en-us&format=rss_200'); 

    $feed->handle_content_type(); 



function image_from_description($data) { 

preg_match_all('/<img src="([^"]*)"([^>]*)>/i', $data, $matches); 

return $matches[1][0]; 

} 



function select_image($img, $size) { 

$img = explode('/', $img); 

$filename = array_pop($img); 



$s = array(

    '_s.', // square 

    '_t.', // thumb 

    '_m.', // small 

    '.', // medium 

    '_b.' // large 

); 



    $img[] = preg_replace('/(_(s|t|m|b))?\./i', $s[$size], $filename); 

    return implode('/', $img); 

} 

?> 


<script type="text/javascript"> 
$(function(){ 
$("#images div").quickpaginate({ perpage: 4, showcounter: false, pager : $("#image_counter") }); 
}); 

</script> 




    <div class="album-wrapper" id="images"> 

     <?php foreach ($feed->get_items() as $item): ?> 

      <div class="photo"> 

       <?php 

        if ($enclosure = $item->get_enclosure()) { 



         $img = image_from_description($item->get_description()); 

         $full_url = select_image($img, 4); 

         $thumb_url = select_image($img, 0); 

         echo '<a href="' . $full_url . '" class="thickbox" title="' . $enclosure->get_title() . '"><img id="photo_' . $i . '" src="' . $thumb_url . '" /></a>'."\n"; 

        } 

       ?> 


      </div> 

     <?php endforeach; ?> 
    </div> 
    <div id="image_counter"></div> 

有人能看到什麼,我已經錯過了或者我做錯了嗎?

感謝,

+0

您是否試過單步執行客戶端上的代碼以查看quickpaginate函數失敗的位置?我對這個插件並不熟悉,但是對於您遇到的實際錯誤的更多信息會對嘗試回答您的問題的任何人有所幫助。 – 2009-11-09 14:49:01

回答

0

你試過試圖隔離在錯誤可能位於什麼地方呢?如果它位於代碼的PHP端或JavaScript端,你能弄明白嗎?

在任何情況下,我已經成功使用Tablesorter插件的jQuery pager同伴插件。但是,對於很長的數據列表來說,這並不是很好。

+0

我不能把它歸結爲它是PHP或Jquery多數民衆贊成在導致這個問題。這是我的代碼,你能看出爲什麼這兩個不鏈接? – 2009-11-10 09:01:48

+0

抱歉 - http://www.faeriecakes.co.uk/cake-gallery.php – 2009-11-10 09:02:26

相關問題