php - Pagination without default order -


i have code below:

$firm_ids = array(81, 96, 18, 5, 105);   $this->paginate = array(       'conditions' => array('firm.id' => $firm_ids),       'limit' => 10,   );  $this->set('firms', $this->paginate('firm'));   

in results have ordering in:

5, 18, 81, 95, 105  

how disable default order if want order initial array ordering?

i found workaround on forum, see if works:

$this->paginate = array(     'conditions' => array('firm.id' => $firm_ids),     'limit' => 10,     'order' => array(         'field(firm.id,' . implode(',',$firm_ids) . ')'     ) ); 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -