Sorry, finally i can solved this. This is my solution :
function paginateSearch($id = array()){
$list = implode(",",$id);
$order = 'FIELD(PhotoAlbum.photo_album_id, '.$list.')';
.....
.....
'order' => $order
}
hope this help someone.
On Sat, 2009-04-18 at 00:33 +0700, yodi wrote:
> Hello all,
>
> I have some ranking system and got some id by rank (not in field but
> processed by script in controller) like this : array('4','2','3');
>
> So, i want paginate this.
>
> $result = array('4','2','3');
> $this->paginate = $this->Photo->paginateSearch();
> $this->set('photos',this->paginate('PhotoAlbum',array('PhotoAlbum.photo_album_id'=>$result)));
>
> But it retrieve result :
> photo[2]
> photo[3]
> photo[4]
>
> I want it ordered by condition :
> photo[4]
> photo[2]
> photo[3]
>
> Anyone can help me how to order pagination by condition id?
>
> in pure mysql query like this : ORDER BY FIELD( id, 5, 34, 9, 25 )
>
> Many thanks
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---