Orkun Posted June 20, 2016 Posted June 20, 2016 How can I query pages from a pagetable which has a repeater, and this repeater has a title or body field. It's like a sub - sub - selector. At the moment I am trying this: $selector = "title|body|headline|link|linktext|introheadline|body2|content.body|content.body2|homeSections.title|homeSections.headline|homeSections.body|newsSections.news.title|newsSections.news.body|slider.body|team.body~=$q, limit=50, template!=news"; But "newsSections.news.title|newsSections.news.body" doesn't work (expected that). I need it because of my News Overview Page which has a newsSections PageTable Field for creating News Year Pages. The PageTable has a repeater where I can create the specific News for the corresponding News Year Page. I want to query the Title and Body field of the News Items.
LostKobrakai Posted June 20, 2016 Posted June 20, 2016 Selectors cannot handle multiple level nesting by using the dot-syntax, but you can use subselectors: https://processwire.com/api/selectors/#sub-selectors 2
Orkun Posted June 20, 2016 Author Posted June 20, 2016 Thank you, this worked for me: $q = $sanitizer->selectorValue($q); $selector = "(title|body|headline|link|linktext|introheadline|body2|content.body|content.body2|homeSections.title|homeSections.headline|homeSections.body|slider.body|team.body~=$q), (newsSections=[news.title|news.body~=$q]), limit=50, template!=news"; $matches = $pages->find($selector);
LostKobrakai Posted June 20, 2016 Posted June 20, 2016 I see you're using a limit, therefore I assume you're using pagination, where this one won't work. Use OR-groups to put both searches into a single selector, if you need pagination to work. If you need more control over the sorting of results take a look at this topic: 1
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