View Single Post
Old 10-16-2012, 05:46 PM   PM User | #4
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Quote:
Originally Posted by sonny View Post
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.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk

Last edited by Redcoder; 10-16-2012 at 05:49 PM..
Redcoder is offline   Reply With Quote