Welcome Guest, Not a member yet? Register   Sign In
click next pagination go to 2 page on url codeigniter 4.3.2
#1

(This post was last modified: 03-03-2023, 01:48 AM by startup.)

my controller
PHP Code:
    $page=(int)($this->request->getGet('page'));
            if(empty($page) || $page == 1)
            {
                $i=0;
            }else{
                $i=$per_page*($page-1);
            }
            $data['pager_link']= $this->pager->makeLinks($page$per_page$total_rows'pagination');
            $camlist$this->m_cam->getCamPro('cam_product'$per_page$i);
        

custom view pagination

PHP Code:
<?php 
use CodeIgniter\pager\PagerRender;
$pager->setSurroundCount('2'?>
<nav aria-label="Page navigation">
    <ul class="pagination" >
    <?php if ($pager->hasPrevious()) : ?>
        <li>
            <a href="<?= $pager->getFirst() ?>" class="page-link" aria-label="<?= lang('Pager.first'?>">
                <span aria-hidden="true"><<</span>
            </a>
        </li>
        <li>
            <a href="<?= $pager->getPrevious() ?>" class="page-link" aria-label="<?= lang('Pager.previous'?>">
                <span aria-hidden="true"><</span>
            </a>
        </li>
    <?php endif ?>
    <?php foreach ($pager->links() as $link): ?>
        <li <?= $link['active'] ? 'class="active"' '' ?>>
            <a href="<?= $link['uri'?>" class="page-link"> 
                <?= $link['title'?>
            </a>
        </li>
    <?php endforeach ?>
    <?php if ($pager->hasNext()) : ?>
        <li>
            <a href="<?= $pager->getNext() ?>" class="page-link" aria-label="<?= lang('Pager.next'?>">
                <span aria-hidden="true">></span>
            </a>
        </li>
        <li>
            <a href="<?= $pager->getLast() ?>" class="page-link" aria-label="<?= lang('Pager.last'?>">
                <span aria-hidden="true">>></span>
            </a>
        </li>
    <?php endif ?>
    </ul>
</nav> 
page =1 when i click next pagination, it show page =4
can someone fix help me?

thank you in advance
Reply
#2

See https://codeigniter4.github.io/CodeIgnit...us-getnext
Reply
#3

(03-03-2023, 03:17 AM)kenjis Wrote: See https://codeigniter4.github.io/CodeIgnit...us-getnext

thank you #kenjis i follow link you , now working perfectly
Reply




Theme © iAndrew 2016 - Forum software by © MyBB