pagination - How to paginate in cakephp by using find? -
this choices table
id | question_id | content 1 1 bee 2 1 fly 3 1 dog 4 2 cat 5 2 bat 6 2 wasp
and questions table
id | content 1 question1 2 item2
this did.with display question choices..what want now, paginate it,more 1 question per page.how this?your appreciated.thanks
$options['fields'] = array('questions.id','questions.content'); $options['joins'] = array( array( 'table' => 'generated_exam_items', 'alias' => 'genexamitems', 'type' => 'inner', 'conditions' => array( 'genexamitems.generated_examination_id' => 25 ) ), array( 'table' => 'questions', 'alias' => 'questions', 'type' => 'inner', 'conditions' => array( 'questions.id = genexamitems.questions_id' ) ), ); $options['conditions']=array('genexamitems.generated_examination_id' => 25,'question.id=genexamitems.questions_id'); $question_detail = $this->question->find('all',$options); $this->set('questions',$question_detail);
$this->paginate = array( 'claim' => array( 'conditions' => array('claim.user_id' => $user['user']['id']), 'fields'=>array('id','description','title','support_count','oppose_count','user_id','created'), 'limit' => 5, 'paramtype' => 'querystring' )); $claim = $this->paginate('claim'); $this->set('claim',$claim);
Comments
Post a Comment