Jump to content

Help with pagination...


iPixel

Recommended Posts

I need some help, at least with the logic i suppose.

I've been googling pagination scripts but all i am able to find is the typical

Prev 1 2 3 4 5 Next and when u click next it takes you to page 3.

Or the other one which only has Prev  1 of 5  Next. Which just doesnt help.

 

Here's what im looking for ...

 

Prev10    1  2  3  4  5  6  7  8  9  10    Next10

 

And when you click Next10 the list will look like so

 

Prev10    11  12  13  14    15    16    17    18    19    20  Next10

 

And so on...

 

Im not quite sure how to get this done, and ive had lots of trouble locating a tutorial

or a script even that does this.

 

I've got my

$page =  isset($_GET['page']) ? $_GET['page'] : null;
if (!is_null($page)) 
{
	$page = $_GET['page'];
}

$limit = 30;
if(empty($page))
{
	$page = 1;
}
$limitvalue = $page * $limit - ($limit);

 

and i already use the $limitvalue and $limit in the queries i run. All i need help with is the generating of the 10 pages with the Previous10 and Next10 links.

 

Any and all help is greatly appreciated. Thank you in advance.

 

~iPixel

Link to comment
https://forums.phpfreaks.com/topic/63220-help-with-pagination/
Share on other sites

What you could do is have the range of pages shown be dependent upon the current page you're viewing, much like how the pagination for this forum works. So if you really needed to view the next ten pages, you could just increase the page count from the current by 10, and solve that problem.

Link to comment
https://forums.phpfreaks.com/topic/63220-help-with-pagination/#findComment-315243
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.