CodeIgniter Forums
Remove /index from pagination URL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Remove /index from pagination URL (/showthread.php?tid=6767)



Remove /index from pagination URL - El Forum - 03-11-2008

[eluser]surfgatinho[/eluser]
Hi,

I've not had too much trouble getting the pagination class to work but am having the following problem.

My base_url is sitename/members. Pages are sitename/members/5 etc. So far, so good! The problem is that the page (< 1 2 3 >) are not reflecting the current page.
I can fix this, but it involves changing the base_url to sitename/members/index which isn't really what I want.

Any ideas?

Many thanks in advance,
Chris


Remove /index from pagination URL - El Forum - 03-11-2008

[eluser]MadZad[/eluser]
Chris,
I'm not sure, but you might have to resort to either using 'index' in your base_url or creating another method in your controller, which is what I did. The problem is that CI will take your 'sitename/members' and find the index function in the members method, and will take 'sitename/members/anything' and try to find the anything function in the members method. You could try setting $config['uri_segment'] = 2 but that's a shot in the dark.

If putting 'index' in your base_url is really unpalatable, perhaps mod_rewrite or CI's routes might be worth looking into. Unfortunately, this is out of my expertise, so I can just be an idea guy here...

Any smarter folk out there have better or more detailed ideas?