Welcome Guest, Not a member yet? Register   Sign In
Pagination inquiry
#1

[eluser]Thorpe Obazee[/eluser]
Is there a way to have the pagination show like this:

Code:
http://localhost/index.php/controller/method/page/2
even it contains more than 1 item per page?

As of now, page 2 URL looks a lot like
Code:
http://localhost/index.php/controller/method/page/15
if you have 15 per page.

It's not really a problem but just an inquiry as of how I can route have this type of pagination.
#2

[eluser]Bramme[/eluser]
I've been wondering about this too (because I'd like to use it too). But I think it would need some library editting. There should be a new config item added:

Code:
$config['full_pages'] = true; // standard false

And in the code there should be a check for it. If it's true, it should return links with $offset / $per_page instead off just $offset. In your code you could then decide to use

Code:
$query_offset = $this->uri->segment(3, 0);
//or
$query_offset = $this->uri->segment(3, 0) * $per_page;

$query = $this->db->select('table', $per_page, $offset);

In your case, it would be uri segment 4 offcourse.
#3

[eluser]Thorpe Obazee[/eluser]
I will check that code and see if it work on my project. I'll get back for an update.
#4

[eluser]jlevine[/eluser]
This is something I ran into tonight. I like to use actual page numbers too. So I went to work and modified the Pagination library. In short, I added a second function that renders the links with actual page numbers instead of offsets. There's an additional config paramater called 'not_offsets' which is FALSE by default. When set to TRUE the original create_links() function calls the new function instead.

I haven't tested this outside of my little WAMP setup but it's working well for me.

I've attached it to this post. Test it out and let me know how it works for you guys.




Theme © iAndrew 2016 - Forum software by © MyBB