Codeigniter pagination |
[eluser]RomanN[/eluser]
Hello. My name is Roman. I've a bit issue with codeigniter pagination class. When I'm using pagination in method that has only one parameter all works well. But when I try to use it in a method with 2 parameters, where I need to specify 'uri_segment' pagination doesn't work well. After switching the page the data is changing but the links left the same as on previous page. Can somebody help me with it? Thanks! Roman
[eluser]RomanN[/eluser]
Here is the part of code where I configure pagination: Code: $pagination_config['base_url'] = base_url().'index.php/quotes/showchapter/'.$chapter_id.'/';
[eluser]Flemming[/eluser]
I think you need to change Code: $pagination_config['uri_segment'] = 2; You should be passing the pagination start number in the uri (is that what $chapter_id is?)
[eluser]RomanN[/eluser]
No, $chapter_id isn't pagination variable. It's first method parameter and the pagination is the second one.
[eluser]Flemming[/eluser]
In that case I think your Code: $pagination_config['uri_segment'] index.php =1 quotes = 2 showchapter = 3 chapter_id = 4 pagination = 5 (and you will need to pass this value to your db query to get the next set of results Does that help?
[eluser]RomanN[/eluser]
Thanks for reply, but not, it didn't help. The same problem. After switching the page the data from db is updated (so pagination variable is correctly passed to a query), but pagination links left the same (look like I'm on 1 page). It's a bit strange, because all works well in the situation with one method parameter, where no need to use 'uri_segment'.
[eluser]Flemming[/eluser]
I'm 90% certain your problem lies with Code: $pagination_config['uri_segment'] = 2;
[eluser]RomanN[/eluser]
[quote author="flemming" date="1256662228"]I'm 90% certain your problem lies with Code: $pagination_config['uri_segment'] = 2; Hope you're right. The full path to my page is: http://localhost/quotes/index.php/quotes...hapter/1/0 Where 1 - is chapter_id and 0 - pagination variable
[eluser]Flemming[/eluser]
Code: $pagination_config['uri_segment'] = 6; should fix it then! The pagination class *tries* to figure out which segement of the URI to use - sometimes it gets it wrong (it's probably using seg(5) because it contains a number) so you have to help it and tell it which segement is the right one to use! |
Welcome Guest, Not a member yet? Register Sign In |