Trying to set a pager ( 5 results per page) for the for loop as shown below. The 'for loop' works like this, the do_search gets the resultset from google web services (not a database call) using google api .
100 results are returned but i want to page 5 results per page.
I couldnt set the pager for the same, how do i set the pager here ?
<?php
....
$number = 0;
for ( $start = 0; $start <= 90; $start=$start+10 ) {
if( do_search( $q, $type, $key, $start, $ret ) ) {
$count = $ret['estimatedTotalResultsCount']; // total number of results
$secs = round($ret['searchTime'],2); // time taken to search (in seconds)
$min = $ret['startIndex']; // first record returned
$max = $ret['endIndex']; // last record returned
if ($max) {
// list results
foreach($ret['resultElements'] as $result) {
if ($result['snippet']) {
$output .= $result['snippet'] . "
\n";
}
$output .= "
";
}
$number++;
} // if ($max) {
else {
form_set_error('$err', t('Sorry, no results were found on this site'));
}
} // if( do_search( $q, $type, $key, $start, $ret ) )
} // for ( $start = 0; $start <= 90; $start=$start+10 ) {