如何在cakephp paginate函数
中按字段列表定义顺序像
$this->paginate = array(
'conditions' => array('Page.provider_id' => $this->provider['Provider']['id']),
'order' => array("FIELD(Page.id,$ids)")
);
其中$ ids包含22,24,29,30,23,25,28,26,27
答案 0 :(得分:1)
$ids = implode(',', $ids);
$this->paginate = array(
'conditions' => array('Page.provider_id' => $this->provider['Provider']['id']),
'order' => "FIELD(Page.id,$ids)"
);