【发布时间】:2018-07-10 18:03:33
【问题描述】:
我有一个用于分页数据的变量 $paginator
在我的控制器中
public $paginator = [
'limit'=>5,
'order'=>[
'author'=>'desc'
]
];
在我的视图模板(.ctp)中
<?= $this->Paginator->prev('<< pre') ?>
<?= $this->Paginator->next('next >>')?>
<?= $this->Paginator->counter() ?>
但我收到很多错误:
注意(8):未定义索引:pageCount [CORE/src/View/Helper/PaginatorHelper.php,第 591 行] 注意(8):未定义索引:count [CORE/src/View/Helper/PaginatorHelper.php, line 595] 注意(8):未定义索引:perPage [CORE/src/View/Helper/PaginatorHelper.php,第 598 行] 注意(8):未定义索引:count [CORE/src/View/Helper/PaginatorHelper.php, line 599] 注意(8):未定义索引:count [CORE/src/View/Helper/PaginatorHelper.php, line 600] 注意(8):未定义索引:页面[CORE/src/View/Helper/PaginatorHelper.php,第613行] 注意(8):未定义索引:当前 [CORE/src/View/Helper/PaginatorHelper.php,第 615 行] 注意(8):未定义索引:count [CORE/src/View/Helper/PaginatorHelper.php, line 616]
我知道只有这一行会导致错误
<?= $this->Paginator->counter() ?>
我无法分页。 为什么会这样? :(
【问题讨论】:
-
显示该视图的整个控制器操作
-
哦。谢谢你。谢谢你,我在控制器中看到了我的失踪。我还没有声明分页 $paginate = $this->paginate($this->Articles); $this->set(compact('$paginate'));
-
我想是的 :)
标签: cakephp-3.0 paginator