Here i am using three categories. I want to fetch the data from a particular category while using pagination.
My code:
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');
*/
}
Use the following