How I implement pagination in custom view file in cakephp 3?

Hi,

In my view file i listed some products and i need pagination in that page for viewing products.
How i use pagination in cakephp 3. Anyone can share me some reference code for view page pagination in cakephp 3.

Thanks.

The pagination component is well documented here: https://book.cakephp.org/3.0/en/controllers/components/pagination.html

But if you need a quick fix, you could go this way ->

When you use bake to generate controllers and views this code is generated for the view:

<div class="paginator">
        <ul class="pagination">
            <?= $this->Paginator->first('<< ' . __('first')) ?>
            <?= $this->Paginator->prev('< ' . __('previous')) ?>
            <?= $this->Paginator->numbers() ?>
            <?= $this->Paginator->next(__('next') . ' >') ?>
            <?= $this->Paginator->last(__('last') . ' >>') ?>
        </ul>
        <p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
    </div>

and on the Controller you will get.

$some_variable = $this->paginate($this->YourCurrentModel);

Thank to your reply…