Jump to content

selector syntax has_parent for page reference


sujag
 Share

Recommended Posts

I'm stuck with the selector syntax for a page reference field. After changing the site structure the old query

$regionEvents = $pages->find("template=veranstaltung,selectLocation.parent=$reg,limit=$limit");

won't work any more, cause I now need a match for the grandparent of the page that is stored in the "selectLocation" page reference field. Just changing to

$regionEvents = $pages->find("template=veranstaltung,selectLocation.has_parent=$reg,limit=$limit");

results in a syntax error "Unknown subfield: has_parent"

What would be the right syntax in this case?

Link to comment
Share on other sites

Have you tried this:

$regionEvents = $pages->find("template=veranstaltung,selectLocation.parent.parent=$reg,limit=$limit");

If this doesn't work, a subselector might be the tool of choice:

$regionEvents = $pages->find("template=veranstaltung,selectLocation=[template=location,has_parent=$reg],limit=$limit");

 

  • Like 1
Link to comment
Share on other sites

Thanks for the suggestion. This works without syntax error, but doesn't give the expected results.

Looking for a single (known) parent works.

$regionEvents = $pages->find("template=veranstaltung,selectLocation.parent=14692,limit=$limit");

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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