Welcome Guest, Not a member yet? Register   Sign In
How to create pagination on CI4
#16

(This post was last modified: 02-26-2024, 06:21 PM by danger89.)

This no longer works... Because I'm no longer able to pass variables to my own pager PHP page in CI4.

I was also using variables to my view as well:
PHP Code:
            'currentPage' => $myModel->pager->getCurrentPage('group1'), // The current page number
            'totalPages'  => $myModel->pager->getPageCount('group1'),  // The total page count 
With the latest CI4 version, this will give you an error message when trying to use this in your pager PHP code:

Quote:Undefined variable $currentPage

To answer my own question. It's solved by calling the methods in the template....


PHP Code:
    <button type="button" class="btn" disabled><?= 'Pagina ' $pager->getCurrentPageNumber(). ' of the ' $pager->getPageCount(); ?></button> 


Keep in mind that you notice also the get methods are changed to getCurrentPageNumber(). And I no longer supply the group.
Reply


Messages In This Thread
How to create pagination on CI4 - by Marcolino92 - 04-08-2020, 10:15 AM
RE: How to create pagination on CI4 - by wdeda - 04-09-2020, 08:38 AM
RE: How to create pagination on CI4 - by wdeda - 04-09-2020, 10:44 AM
RE: How to create pagination on CI4 - by wdeda - 04-09-2020, 01:01 PM
RE: How to create pagination on CI4 - by waleed - 02-18-2021, 03:08 AM
RE: How to create pagination on CI4 - by Mano - 09-17-2021, 05:29 PM
RE: How to create pagination on CI4 - by wdeda - 04-10-2020, 05:09 PM
RE: How to create pagination on CI4 - by InsiteFX - 09-18-2021, 01:07 AM
RE: How to create pagination on CI4 - by danger89 - 02-26-2024, 05:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB