2008年10月18日星期六

Re: [fw-webservices] ZEND Feed and me trying to paginate it

kwylez wrote:
>
> Try doing:
>
> $feed = new
> Zend_Feed_Atom('http://wildoakrestaurant.blogspot.com/atom.xml'<http://wildoakrestaurant.blogspot.com/atom.xml%27>
> );
> $feedLimit = 5;
>
>
> $f = new LimitIterator($feed, $feedLimit);
>
> $f->seek(5) should return the last item since your feed limit is 5. I
> will
> try and full test the example a little later when I can get to my
> computer.

Ahah! Bingo! We have a winner :-)

Thank you Corey.

So I extended a bit:

$feed = new
Zend_Feed_Atom('http://wildoakrestaurant.blogspot.com/atom.xml');

$resultCount = $feed->count();

$feedLimit = $resultCount-1;
$f = new LimitIterator($feed, $feedLimit);
$f->seek($resultCount);

I added in a $resultCount to the above code which enabled me to seek to the
first entry blog post made (aka the last entry in the XML structure). Which
is excellent, as I think that now means I should be able to programmatically
construct some pagination.

For the sake of completeness, I would love to be able to plug into the
ZEND_Paginator but it's mysterious ways are eluding me.

Seems like a perfect fit - consuming a Feed and then paginating it.

Thanks for all the help.

fc.

--
View this message in context: http://www.nabble.com/ZEND-Feed-and-me-trying-to-paginate-it-tp20043583p20051104.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

没有评论: