Undefined variable $ inside template pagination |
Hello all!
after upgrading from 4.2.2 to 4.4.3 and php7.4 to 8.2 my pagination template started to fail, isn't get some vars from controller, perhaps I missed something during upgrade and a little help can solve this issue. Undefined variable $ ---------- config/pager.php - OK PHP Code: public array $templates = [ Controllers/Main.php - OK PHP Code: public function pagination(){ /Views/pages/list.php - OK PHP Code: $pager->makeLinks($page, $perPage, 'front_full') /Views/layouts/custom_pagination.php- OK but don't receive $page or $perPage vars... -> Undefined variable $page and $perPage Thank you for your support,
Now Pager does not use the shared View instance.
See https://github.com/codeigniter4/CodeIgni...ssues/7703 (11-09-2023, 10:13 PM)kenjis Wrote: Now Pager does not use the shared View instance. Thanks for your answer, I didn't saw any related info regarding that under: https://www.codeigniter.com/user_guide/i...ading.html or https://www.codeigniter.com/user_guide/l...ation.html ... Does codeigniter4 provide that with some builtin function or we've to build it? Regards,
It is a bug fix. No detailed info is documented in the user guide.
Why do you need these variables? Can you get needed info from the $pager object?
To display the number of records from tables in many pages without write the same code and html/css in every one.
Use the Pager object instead of variables to Views.
https://github.com/codeigniter4/CodeIgni.../Pager.php
(11-09-2023, 12:01 PM)rax Wrote: Hello all!You can try: <php $pager_inf = \Config\Services::pager() $page = $pager_inf -> getCurrenPage(); $total = $pager_inf ->getTotal(); $perPage = $pager_inf->getPerPage(); ?> } ?> |
Welcome Guest, Not a member yet? Register Sign In |