【发布时间】:2015-08-26 15:47:05
【问题描述】:
这里我使用了三个类别。我想在使用分页时从特定类别中获取数据。
我的代码:
public function index( $category_id = null )
{
if (!$this->KnowledgeSolution->KnowledgeCategory->exists( $category_id ))
{
throw new NotFoundException(__('Invalid Knowledge Category'));
}
$KnowledgeCategory = $this->KnowledgeSolution->KnowledgeCategory->read(null,$category_id);
$this->set('KnowledgeCategory', $KnowledgeCategory);
$this->Paginator->settings['contain'] = array('Users', 'KnowledgeReply'=>array('Users') );
$this->set('KnowledgeSolutions', $this->Paginator->paginate());
/*
$this->paginate = array('conditions' => array('Product .title LIKE' => 'a%'),'limit' => 10 );
$data = $this->paginate('Product');
*/
}
【问题讨论】:
标签: php cakephp pagination cakephp-2.0