Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cakephp 类别列表分页_Cakephp_Cakephp 2.2 - Fatal编程技术网

Cakephp 类别列表分页

Cakephp 类别列表分页,cakephp,cakephp-2.2,Cakephp,Cakephp 2.2,我在CategoriesController中的admin_index()方法中使用了以下代码 $this->set('title_for_layout', __('Categories', true)); $treelist = $this->Category->generateTreeList(null, null, null, '_'); $categories = $this->Category->children(); $i = 0; foreach (

我在CategoriesController中的admin_index()方法中使用了以下代码

$this->set('title_for_layout', __('Categories', true));
$treelist = $this->Category->generateTreeList(null, null, null, '_');
$categories = $this->Category->children();
$i = 0;

foreach ($treelist as $value) {
    $categories[$i]['Category']['path'] = $value;
    $i++;
}

$this->set(compact('categories'));

如何对类别列表进行分页?

您应该可以调用分页

$this->set('categories', $this->paginate());

您需要确保视图中有分页控件。

看起来您没有遵循任何分页文档。您需要使用分页帮助器和组件来实现标准分页。