0

我正在使用定制的 Jquery/PHP 库脚本,它从 Flickr 提要中提取图像。我试图实现 JQuery 分页插件,但无济于事。

这是代码...

<?php

require_once('php/simplepie.inc');

$feed = new Simplepie('http://api.flickr.com/services/feeds /photos_public.gne?id=44262300@N06&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>

谁能看到我错过了什么或我做错了什么?

谢谢,

4

1 回答 1

0

Have you tried trying to isolate the area where the error might be located? Can you figure it out if it is in the PHP-side of your code or on the JavaScript side?

In any case, I've had success using the jQuery pager companion plugin for the Tablesorter plugin. It doesn't work very well for very long lists of data, however.

于 2009-11-09T16:56:26.340 回答