【发布时间】:2017-11-10 00:04:53
【问题描述】:
您好,我正在尝试在单元格中使用 Paginator,Paginator 工作正常,但单元格模板中的 PaginatorHelper 不起作用。
我正在使用 CakePhp 3.5
这是我的代码
src/View/Cell/FinderCell.php
namespace App\View\Cell;
use Cake\View\Cell;
use Cake\Datasource\Paginator;
class FinderCell extends Cell {
public function display() {
$this->loadModel('Pokemon');
$paginador = new Paginator();
$pokemons = $paginador->paginate(
$this->Pokemon->find()
);
$this->set(compact('pokemons'));
}
}
src/Template/Cell/Finder/display.ctp
<?php
foreach ($pokemons as $pokemon) :
?>
<div class="tipo form large-2 medium-2 columns content">
<?php echo $this->Html->image($pokemon->pokemon_image) ?>
</div>
<?php endforeach; ?>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->prev('<< Anterior') ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next('Siguiente >>') ?>
</ul>
<p><?= $this->Paginator->counter() ?></p>
</div>
我明白了
【问题讨论】:
标签: cakephp pagination cakephp-3.0