![]() |
Pagination help - 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: Pagination help (/showthread.php?tid=3759) |
Pagination help - El Forum - 10-20-2007 [eluser]feri_soft[/eluser] I have a default controller set to products. and i have this code for pagination: Code: class Products extends Controller And in routes i have the following: Code: $route['products/:num'] = "products/index"; Its not working at all i get 404 not found error. But when i remove the route and change the products to: Code: $config['base_url'] = base_url(). 'products/index/'; Code: $this->uri->segment(2) Please tell me whats the problem. I have checked the user guide but nothing on this issue was posted. I have to find a solution on this. Thanks! Pagination help - El Forum - 10-20-2007 [eluser]unosoft[/eluser] When you specify route like below, are you not specifying that any number that follows products in the URL, pass it as a parameter to the index function? $route['products/:num'] = "products/index"; But your index function has no parameters. I believe thats why you are getting 404 error. hth Kumar Bhogaraju Pagination help - El Forum - 10-21-2007 [eluser]feri_soft[/eluser] I didnt quite undestand but i think the function doesnt need a parameter. I get the number by: $this->uri->segment(2) Any suggestions? IS it possible that to be a bug only with the index function? Pagination help - El Forum - 10-21-2007 [eluser]gunter[/eluser] so it does not work if you call the page products/ does it work if you add a parameter? products/11 Pagination help - El Forum - 10-21-2007 [eluser]feri_soft[/eluser] NO i mean that if the paging query is set to products/ it doesnt work and if its products/index/ it does. It adds the parameter itselft like when i click page 2 it shows products/2 and if its with index - products/index/2 but the difference is that the first way its not working and the second it does. Pagination help - El Forum - 10-21-2007 [eluser]gunter[/eluser] Ok, then I cannot help, I thought that /products don“t work, but products/2 does... that would be because the router needs the :num argument... then good luck! :coolsmile: |