CodeIgniter Forums

Full Version: Pagination highlighting not working - question about "missing" segments
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]tinawina[/eluser]
I have pagination running throughout my site. It works flawlessly except for one case where pagination displays almost perfectly. We get:

Code:
1 2 3 4 >> Last >

but only the "1" is ever highlighted regardless of which page you are viewing. Clicking on "Last >" displays the right content but the pagination links do not change to include "< First << 1 2 3 4..." The content of the pages as you click through pagination is correct, it's just the page highlighting that doesn't work.

Here's the thing - we are doing a lot of processing in the construct of the one controller where pagination isn't working where we use the URI class to break URI segments into variables that we then use to figure out what views/tools to load to the screen. By the time the page that contains the pagination links is rendered, the URL doesn't actually include /limit/10 or the like. For example, in all of our working pagination pages, the URL is something like http://www.blah.com/page/limit/10. But in our non-working pagination page the URL is something like http://www.blah.com/page.

So my question: Does the pagination class need the actual /limit/X segment in the URL to work properly? Or should it work fine by us simply passing it the data it needs ($config['uri_segment']) within the controller?

Appreciate any help with this.

El Forum

[eluser]stevezissou[/eluser]
Well, you obviously will need to provide some sample code for anyone to debug your issue. Wink

...but for pagination, if $config[‘uri_segment’] is set to segment 3 and your URL never contains a 3rd segment with a numeric value, then CI pagination is always going think you are on page one when generating pagination links.

El Forum

[eluser]tinawina[/eluser]
Thanks stevezissou. And that's what dawned on me after hours of trying to sort this out. I don't need the code debugged b/c it absolutely works. It is just this segment thing. Hmmmmm, I wonder if I can do some sort of trick with routing to deal with populating a segment for pagination? Back to the drawing board. Thanks!