【问题标题】:cakephp pagination togglecakephp 分页切换
【发布时间】:2012-04-07 05:24:04
【问题描述】:

我有很多用户,我正在使用分页,但我的经理希望我有一个选项,可以在一个页面上看到所有用户。我怎样才能做到这一点。我在用户索引操作中有这个

public function index() {
                            $this->User->recursive = 0;
                            $this->set('users', $this->paginate());
}

谢谢

【问题讨论】:

    标签: cakephp cakephp-1.3 cakephp-2.0


    【解决方案1】:

    (这个问题好像太简单了……可能是我理解错了?)

    常规的 find('all') 怎么样?

    public function index($all = false) {
        $this->User->recursive = 0;
    
        if($all){
            $this->set('users', $this->User->find('all'));
        } else {
            $this->set('users', $this->paginate());
        }
    }
    

    然后去 /users/all

    【讨论】:

      猜你喜欢
      • 2013-08-17
      • 1970-01-01
      • 1970-01-01
      • 2019-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-14
      • 1970-01-01
      相关资源
      最近更新 更多