cakephp分页

时间:2011-01-17 19:49:19

标签: cakephp

如何在一个控制器中使用多个分页? 我有这段代码:

var $paginate = array(
        'post' => array(
            'limit' => 2,
            'order' => array(
                'post.id' => 'asc',
            ),
        ),
    );
**And in the same controller need this paginate:**
    var $paginate = array(
            'post' => array(
                'conditions' => array('Post.name IS NULL or Post.id>50'),
                'limit' => 20,
                'order' => array(
                    'post.id' => 'asc',
                ),
            ),
        );

如何在一个控制器中使用两个不同的分页?

1 个答案:

答案 0 :(得分:1)

function otherAction() {
    $this->paginate = array('post' => array('conditions' => ...)));
    $posts = $this->paginate();
}

$posts = $this->paginate('Post', array('conditions' => array()));
相关问题