Gazley Posted September 11, 2012 Share Posted September 11, 2012 Hi there, Normally, I when I need to query pages by a specific category, I am quite happy for the natural returned results subject to the limit parameter, in this case limit=4 I have come across a special case where I want to specify that one item of the four equals an exact identity and that the other three values can be anything. Here is the usual case: $albums = $pages->get('/albums/')->find("categories_selected=$page, limit=4"); This is the special case that returns a single targeted album: $albums = $pages->get('/albums/')->children("categories_selected.name={$albumSegment}")->find("name=$albumName"); What I want is a combination of the two queries where one of the initial 4 returned values is the value of the second query. Any further paginated results should obviously exclude any of those (including the special case) in the original 4. On first thoughts, it seems that I might need to do two queries and append the results but I thought I would ask and see if I'm missing something obvious. Many thanks. Link to comment Share on other sites More sharing options...
Gazley Posted September 11, 2012 Author Share Posted September 11, 2012 Maybe I could set a sort-order value at run-time where the special case gets the highest sort value? In that case, the pagination should work in the usual way too. Sound reasonable? Link to comment Share on other sites More sharing options...
slkwrm Posted September 11, 2012 Share Posted September 11, 2012 Gazley, I think appending your special page like you intend is a good way to handle it (PW should take care of duplicated pages in array). And runtime sort sounds good to me too. So this is basically a cheer up post 1 Link to comment Share on other sites More sharing options...
Soma Posted September 11, 2012 Share Posted September 11, 2012 You're much into albums. Did you know "Alb" is ancient german myth creature that sit on your chest at night and make you have bad dreams "Albträume"? After reading you post I have more questions than you, so I think. I might get some sleep, have to pass on this for now. 1 Link to comment Share on other sites More sharing options...
Gazley Posted September 11, 2012 Author Share Posted September 11, 2012 Hey Soma, Of course I'm into Albums, it's a photography site! Sweet dreams, and don't think about this too much Cheers! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now