第一次正确显示分页链接,但是当我点击第二页链接时,数据会消失。
这是我的代码:
class PostsController extends AppController {
public $components = array('Paginator');
var $paginate = array(
'Post' => array(
'limit' => 5
)
);
public function index() {
//debug("in index");
//$this->render();
$d=$this->data['lower_limit'];
//debug(" df ");
//debug($d);
$lower= $this->data['lower_limit'];
$upper= $this->data['upper_limit'];
$conditions = array('Post.post_id >=' => $lower, 'Post.post_id <=' => $upper);
$this->Paginator->settings = $this->paginate;
$data = $this->Paginator->paginate('Post', $conditions);
$this->set('data', $data);
$this->set('lower_limit',$lower);
$this->set('upper_limit', $upper);
}
}
我没有覆盖paginate和分页计数方法。