Jump to content

Specify page query target with "unspecified others"


Recommended Posts

Posted

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.

Posted

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?

Posted

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 :P

  • Like 1
Posted

You're much into albums. :P

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. :D

  • Like 1
Posted

Hey Soma,

Of course I'm into Albums, it's a photography site! Sweet dreams, and don't think about this too much ;)

Cheers!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...