Hellow Good day. I’m having trouble with my pagination numbers not showing and when i press next it doesn’t show the other data in the database. here’s my code
Template
<div class="col-lg-4 col-md-6">
<div class="box" data-aos="zoom-in-right" data-aos-delay="200">
<h3>Patag Price to Destination</h3>
<ul>
<!-- using foreach method variable as key to anothername to be called -->
<?php foreach ($patagprices as $key => $patagprice): ?>
<!-- data on the price displayed from the database -->
<li> P<?= $patagprice->price?> to <?= $patagprice->destination?> (<?= $patagprice->modified?>)</li>
<?php endforeach; ?>
</ul>
<div class="pagination pagination-md justify-content-center mt-5">
<?= $this->Paginator->prev("Previous") ?>
<?= $this->Paginator->numbers(); ?>
<?= $this->Paginator->next("Next") ?>
</div>
</div>
</div>
Controller
//in this code this will fetch data from the prices in the database from PATAG Station
$this->loadModel('Patagprices'); //inside the parenthesis is the table name
$this->set('patagprices', $this->paginate($this->Patagprices));
$patagprices = $this->Patagprices->find('all')->order(['Patagprices.destination' => 'ASC']); //get inside the variable $patagprices then the selected order on value which will be displayed.
$this->set('patagprices',$this->paginate($patagprices,['limit'=>'5'])); //the first '' will define the database and then the variable $
paginator-template
<?php
return [
'number' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
'nextActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
'nextDisabled' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
'prevActive' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
'prevDisabled' => '<li class="page-item"><a class="page-link" href="{{url}}">{{text}}</a></li>',
'current' => '<li class="page-item active"><a class="page-link" href="{{url}}">{{text}}</a></li>',
];
Please help me. It was working in my early development on the system. i don’t know why it doesn’t work now. thank you for your time.