PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Working with Multi-page Feeds

When retrieving a feed that contains a large number of entries, the feed may be broken up into many smaller "pages" of feeds. When this occurs, each page will contain a link to the next page in the series. This link can be accessed by calling getLink('next'). The following example shows how to retrieve the next page of a feed:

<?php
function getNextPage($feed) {
    
$nextURL $feed->getLink('next');
    if (
$nextURL !== null) {
        return 
$gdata->getFeed($nextURL);
    } else {
        return 
null;
    }
}

If you would prefer not to work with pages in your application, pass the first page of the feed into Zend_Gdata_App::retrieveAllEntriesForFeed(), which will consolidate all entries from each page into a single feed. This example shows how to use this function:

<?php
$gdata 
= new Zend_Gdata();
$query = new Zend_Gdata_Query(
        
'http://www.blogger.com/feeds/blogID/posts/default');
$feed $gdata->retrieveAllEntriesForFeed($gdata->getFeed($query));

Keep in mind when calling this function that it may take a long time to complete on large feeds. You may need to increase PHP's execution time limit by calling set_time_limit().

Zend Framework