Pagination with URI segment - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Pagination with URI segment (/showthread.php?tid=82715) |
Pagination with URI segment - mohs3n - 08-14-2022 Hello all I am writing a simple blog application and want to have a pagination like the following: https://sampleblog.local/posts/page/2 Default pagination is like: https://sampleblog.local/posts?page=2 I have read the documentation : https://codeigniter4.github.io/CodeIgniter4/libraries/pagination.html?highlight=pagination#specifying-the-uri-segment-for-page But still cannot implement it. I would appreciate it if anyone can provide a sample code. My controller: PHP Code: $data['articles'] = $posts->orderBy('id','DESC') RE: Pagination with URI segment - ozornick - 08-14-2022 $model->paginate(5, 'default', null, 3); Set last parameter as segment number (test 2 or 3) |