2011-12-28 49 views
2

如何将这个statment与条件规则分页转换如何添加条件分页CakePHP中1.3

$comment = $this->Article->Comment->find('all', 
      array('conditions' => 
    array('Comment.article_id' => $id, 'Comment.status' => 1))); 

我这样做,但我得到parce错误

var $paginate = array(
      'limit' => 5, 
      'page' => 1, 
      'order' => array('Comment.created'=>'desc'), 
      'conditions' => array('Comment.article_id' => $id, 'Comment.status' => 1) 
      ); 
$this->Article->Comment->recursive = 1; 

this->set('comment', $this->paginate()); 
+0

你得到了什么错误? ('this-> set'应该是'$ this-> set') – Dave 2011-12-28 14:42:31

回答

2

按照循序渐进的逐步骤说明here

+0

ok Dave谢谢.. – user1080247 2011-12-28 13:57:48

+0

请参阅我的代码请 – user1080247 2011-12-28 14:16:44

+0

请尝试按照说明进行操作,然后根据您的需求进行调整,而不是关闭你自己的第一个,并陷入错误的东西,不在说明中。 – Dave 2011-12-28 14:48:03