2012-04-30 3 views
1

는 지금이정렬 및 페이지 매김 CakePHP의

public function station_users($id=null){ 
     $users = $this->User->find('all',array('conditions'=>array('test_id'=>$this->params['named']['test_id']))); 

     $this->set('users', $users); 
     $this->render("station_users",'ajax'); 
    } 
내가 특정 테스트 ID에 대한 모든 사용자를 얻고있다

하지만 내 정렬 나던 일이. 페이지 매김을 어떻게 추가 할 수 있습니까?

$this->paginate = array 
    (
     'User' => array 
     (
      'recursive' => 0, 
      'conditions' => array 
      (
       'test_id' => $this->params['named']['test_id'], 
      ), 
     ) 
    ); 

$users = $this->paginate('User'); 

Cookbook 당신의 친구, 사용은 다음과 같습니다 나는, 당신이 이런 일에, 당신의 페이지 매김을 구성해야 $this->paginate() 호출하기 전에

$this->User->recursive = 0; 
     $this->set('users', $this->paginate()); 

그 didnt 한 작업 감사

+0

어떻게 작동 했습니까? 페이지 매김을 처리 할 수 ​​있도록보기가 올바르게 설정되어 있습니까? – mensch

답변

2

시도 언제든지 가능합니다.