I am using CakePHP 2.3.7. To show content to the user I have a model called contents. The controller gets data from this model and sends it to the view by using pagination. So far, everything works fine. Now I want to show the content in a very specific order. For all I know I cannot use the "order"-parameter in paginate() because the order is:
- individual for each user (and therefore not a field in the database)
- changing frequently based on a complex calculation created on the fly
- currently stored in a session array
I have an array containing all relevant item-IDs and a value that defines the position in the order. What I need is a way to teach the pagination to use the order I have defined in the array instead of any sortation from the database. The array I have looks like the one below, where the first number is the position in the order and the second is the ID of the item.
Is there a way to tell the pagination to use this specific item order?
array(
(int) 0 => '308',
(int) 1 => '311',
(int) 2 => '313',
(int) 3 => '317',
(int) 4 => '325',
(int) 5 => '326',
)