【发布时间】:2012-07-19 12:06:32
【问题描述】:
我正在使用 Cakephp 1.2。我应该能够使用分页按 A-Z 或 Z-A 排序。但是,我在下面收到此错误。在其他资源中找不到太多信息。请帮忙。
注意(8):未定义变量:分页器[APP/views/elements/products.ctp,第25行] 致命错误:在第 25 行的 /Applications/MAMP/htdocs/development03/app/views/elements/products.ctp 中对非对象调用成员函数 sort()
控制器
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; ?>
【问题讨论】:
标签: php cakephp cakephp-1.2