Manual pagination problem in CI4. |
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.p...cto/list/1 <--- page http://localhost/test_pagination/index.p...ect/list/2 http://localhost/test_pagination/index.p...cto/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);
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......?page=1.......... PHP Code: $page = $this->request->getGet ( 'page' ) ? $this->request->getGet ( 'page' ) : 0
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
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');
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. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |