Interesting problem with pagination
Hi all,
I've got a problem which I hope is interesting to everyone.
Got a generic table, in which each item has an image and an attribute that says wether the orientation is portriat or landscape.
id int(10) unsigned NOT NULL
namevarchar(255) NULL
image varchar(255) NULL
image_portrait tinyint(1) unsigned NOT NULL
Now I need to paginate the results so that there are always 1 portrait images for every 2 landscape images.
So I want a paginate with limit of 6 say, return the following:
array( (int) 0 => array( 'Item' => array( 'id' => '1', 'name' => 'container', 'image' => 'CH1.a.jpg',
) ), (int) 1 => array( 'Item' => array( 'id' => '2', 'name' => 'container', 'image' => 'CH1.a.jpg' ) ), (int) 2 => array( 'Item' => array( 'id' => '3', 'name' => 'container', 'image' => 'CH1.a.jpg' ) ), (int) 3 => array( 'Item' => array( 'id' => '4', 'name' => 'container', 'image' => 'CH1.a.jpg' ) ),
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home