Quote:
Originally Posted by sonny
Hi
PHP Code:
for ($i=1; $i <= $pages; $i++) // loop through each page and give link to it. { $ppage = $limit*($i - 1); if ($ppage == $page){ echo("<b>$i</b>\n");} // If current page don't give link, just text. else{ echo("<a href=\"search.php?query=$query&page=$ppage&limit=$limit\">$i</a> \n");} }
if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { // If last page don't give next link. $next_page = $page + $limit; echo(" <a href=\"search.php?query=$query&page=$next_page&limit=$limit\">next</a>");} //------------------------END BOTTOM OF PAGE
|
Check out this modification:
PHP Code:
for ($i=1; $i <= $pages; $i++) // loop through each page and give link to it.
{
$ppage = $limit*($i - 1);
if ($ppage == $page){
echo("<b>$i</b>\n");} // If current page don't give link, just text.
else{
echo("<a href=\"search.php?query=$query&page=$ppage&limit=$limit\">$i</a> \n");}
//Change
if($i>$page+10){
$i+99; //Adds 99 to $i hence from page 10, the pages skip by 100
//Because there is another 1 being added at the for loop
//Change 99 to whatever interval you want
}
//Change ends here
}
if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { // If last page don't give next link.
$next_page = $page + $limit;
echo(" <a href=\"search.php?query=$query&page=$next_page&limit=$limit\">next</a>");}
//------------------------END BOTTOM OF PAGE
Hence they'll appear something like: 5,6,7,8,9,10,11,12,13,14,15,115,215,315
If you have a specific interval and format of display you'd like, post again and i'll show you the code modification you'll need.