Pagination links screwed up |
[eluser]mikedfunk[/eluser]
I have 4 news items in my database and I limited the per_page to 1. When I run pagination I get this: 1 2 3 > last > I only get 3 links. Even crazier: link 2 links to page 1, link 3 links to page 2, and last links to page 1. When I manually adjust the URL in the location bar it works fine, that's the kicker. Here's my routing (I have htaccess set up to remove index.php): Code: $route['(.*)/news/(.*)'] = "news/index/$1/$2"; I don't think that should affect the pagination though. Here's my controller: Code: // loaded pagination library of course or i wouldn't be getting the links So I would type http://localhost/us/news/page/1 to get to a page. And in the view the only thing of consequence is the create_links() Code: <?php foreach ($news->result() as $item): ?> Why are my paging links screwed up? I read the documentation and read up on other threads, the usual answer seems to be to set the $config['uri_segment'] properly. I did that. What's the deal? :grrr:
[eluser]hbr[/eluser]
hi mikedfunk, I have exactly the same problem as you, I am fighting with it since yesterday but in vain. Either there is a bug in the class, or the doc is not very clear about how to set the config up.
[eluser]Sarfaraz Momin[/eluser]
Atlast someone has been facing some issues which I faced quite sometime back. What I did was write a small helper function to take of this issue. I don't know weather or not it would help you. But you can take a look at it. Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
[eluser]hbr[/eluser]
thanks for sharing it Here is the one I am using, but it is still a draft, I am going to clean it, change the variables and function names to be more significative. But one thing is good about it, it works :p The Library : Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); And how to use it : Code: $pg = new Pager(); The result looks like this : |< << 1 2 3 4 [5] 6 7 8 9 >> >| Enjoy |
Welcome Guest, Not a member yet? Register Sign In |