![]() |
Manual pagination problem in CI4. - 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: Manual pagination problem in CI4. (/showthread.php?tid=77001) |
Manual pagination problem in CI4. - hugoafr - 07-10-2020 Hello, Sorry for my english I have the following problem when paging manually, I can't make the pager links look good. I need the following links: http://localhost/test_pagination/index.php/proyecto/list/1 <--- page http://localhost/test_pagination/index.php/project/list/2 http://localhost/test_pagination/index.php/proyecto/list/3 .... etc in the controller function list ($page = 1 ,,,,,,) { And the pager gives me the following: http://localhost/project/list/1 .... http://localhost/project/list/2 .... http://localhost/project/list/3 .... With $ pager->setPath (); I can not configure the links as in ci3, $ this-> load-> library ('pagination'); $ config = $ this-> pager_config; $ config ['base_url'] = site_url ('project / list /'); Does anyone have the same problem? PHP Code: $data_db = $this->proyecto_model->list_proyecto ( $data_search, $limit, $page); RE: Manual pagination problem in CI4. - hugoafr - 07-13-2020 I solved my problem but I don't know if it will be the correct way. I have my system configured with the following path PHP Code: App.php The $pager->setPat() function; return "localhost" only By adding $_SERVER['PHP_SELF'] I can fill in the required url. PHP Code: $pager->setPat($_SERVER['PHP_SELF']) http://localhost/test/index.php/proyecto/list/arg.../arg....?page=1.......... PHP Code: $page = $this->request->getGet ( 'page' ) ? $this->request->getGet ( 'page' ) : 0 RE: Manual pagination problem in CI4. - InsiteFX - 07-14-2020 That is wrong your base url should be set to the root of the application. PHP Code: public $baseURL = 'http://localhost/'; Did you try using the method setPath? PHP Code: $pager->setPath(base_url('test_pagination/index.php/proyecto/list/'), 'Test-group'); // Additionally you could define path for every group. See if that works for you. RE: Manual pagination problem in CI4. - hugoafr - 07-14-2020 Hello, Thanks for the collaboration, the following instruction returns the following: $ pager-> setPath (base_url ('test_pagination / index.php / project / list /'))---> http://localhost/http://localhost/test_paginatio ........... localhost is duplicated in url ,,,, the solution as you indicate is to put the following path to base_url ,,,, but it is not very elegant, in ci2/3 it is simple PHP Code: $ this-> load-> library ('pagination'); RE: Manual pagination problem in CI4. - InsiteFX - 07-15-2020 Being as I see that you have index.php in there use site_url() instead. It should work using the segment if your controller is running it all. |