cakephp paginate发布数据

时间:2014-04-24 04:19:48

标签: php cakephp

我需要使用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()); 

   }    
}

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

1 个答案:

答案 0 :(得分:0)

你需要在切换页面时发送$ type param,如果是一个带有一个字段的简单搜索,我也会使用get方法,从我看到你没有测试方法,所以你可以轻松添加搜索pag到分页中的URL

here关于此的另一个问题,您也可以尝试官方documentation

相关问题