【问题标题】:cakephp paginate post datacakephp对帖子数据进行分页
【发布时间】:2014-06-09 04:43:25
【问题描述】:

我需要使用 pos 数据创建搜索方法:

搜索方法:

public function find_estate () {

        if(isset($this->request->data['type'])){
            $type =$this->request->data['type'] ;           
        }else{$type="";}
           if($type!=""){
               if ($type != "all"){
               $where[] = "Estate.melk_type LIKE '$type'";
               }
           }
           }

if(isset($where)){         

         $this->paginate = 
             array(
                     'Estate'=>
                        array(

                            'limit' => 4,
                            'order' => array(
                                'Estate.eid' => 'desc'
                            ),

                             'fields' => array('eid','melk_type','status ','image'),
                             'conditions' => implode(" AND ",$where), 

                            ));     

                 $this->set('estate',$this->paginate()); 

   }    
}

但在搜索结果的其他页面中不起作用 如何使用帖子数据进行分页?

【问题讨论】:

    标签: php cakephp


    【解决方案1】:

    您需要在切换页面时发送 $type 参数,如果它是一个带有一个字段的简单搜索,我也会使用 get 方法,据我所知,您没有测试该方法,因此您可以轻松添加搜索参数到分页中的网址

    here的另一个问题,你也可以试试官方documentation

    【讨论】:

    • 这是5个参数的示例代码,可用于搜索。我如何发送带有分页的参数?请提供代码示例
    猜你喜欢
    • 2016-10-13
    • 1970-01-01
    • 1970-01-01
    • 2019-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-04
    • 2023-03-10
    相关资源
    最近更新 更多