![]() |
Pagination over method parameters not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Pagination over method parameters not working (/showthread.php?tid=1522) |
Pagination over method parameters not working - rakibtg - 03-17-2015 Hello CI Community, i am having problem for the pagination over method parameters. My routes: PHP Code: $route['tag/(:any)'] = 'tag/index/$1'; The pagination works just perfect until i press the next page link! PHP Code: $pager['base_url'] = '/tag/'.$tagDetail->slug; Edit: If i add the method name in the pagination's base_url like this PHP Code: $pager['base_url'] = '/tag/index/'.$tagDetail->slug.'/'; Code: ... ORDER BY p.date DESC LIMIT people,20 Have a great day. RE: Pagination over method parameters not working - sajid19991 - 03-18-2015 well you said that your pagination is working, but its not (pagination link's on supplied page are throwing 404 error). Post your controller code here so others can take a look and help, im a noob when it comes to routes.. RE: Pagination over method parameters not working - karthik_code - 03-19-2015 The below part of documentation may help you fix this issue : http://www.codeigniter.com/userguide3/installation/upgrade_300.html#step-9-update-your-config-routes-php-containing-any Then, Did you initialize the pagination with $config["uri_segment"] = 3; parameter? (change the segment number according to the url) RE: Pagination over method parameters not working - rakibtg - 03-19-2015 @karthik_code Thanks for your reply. Here is my pagination setup: PHP Code: //$pager['base_url'] = '/tag/index/'.$tagDetail->slug.'/'; RE: Pagination over method parameters not working - karthik_code - 03-20-2015 I have checked your website. Pages with people tag throws 'No photo' message on page number 4 and above. This is due to the following hard coded value in the above code. $pager['total_rows'] = 200; Dynamically count and set total rows like this. $pager['total_rows'] = $this->photo_model->count_by_tag($slug); (You may know this already because other pages programmed perfectly). RE: Pagination over method parameters not working - rakibtg - 03-20-2015 I have solved the problem using a custom hack... Thanks for mentioning counting total rows dynamically |