我正在使用 Cakephp 1.2。我应该能够使用分页按 AZ 或 ZA 进行排序。但是,我在下面收到此错误。在其他资源中找不到太多信息。请帮忙。
注意 (8):未定义变量:分页器 [APP/views/elements/products.ctp,第 25 行] 致命错误:在 /Applications/MAMP/htdocs/development03/app 中的非对象上调用成员函数 sort() /views/elements/products.ctp 第 25 行
控制器
var $helpers = array('Html','Form','Ajax','Javascript', 'Text');
// Pagination
var $paginate = array('limit' => 8, 'page' => 1,'order'=>array('Product.name' => 'asc'));
函数列表(){
$categories = $this->Category->find('all', array('order' => 'Category.id ASC' ));
$categories = $this->Category->buildCategories($categories, $this->passedArgs['c']);
$children_ids = $this->Category->getChildCategories($categories, $this->passedArgs['c'], true);
$allCatIds = array_merge(array($this->passedArgs['c']), $children_ids);
//return lists
return $this->Product->lists($allCatIds);
}
元素
<?php
$products = $this->requestAction("/products/lists/c:$catId/");
?>
<?php echo $paginator->sort('Name', 'name', array('title' => 'Sorting Title Alphabetically','class' => 'normalTip')); ?>
<?php foreach ($products as $product): ?>
...
<?php endforeach; ?>