strandoo Posted February 3, 2022 Share Posted February 3, 2022 Hi. Sorry if this has been covered someplace. I've got a Conventions site with Events pages. Among other things, each Event has a bunch of Topics and each Topic can have one or more Speakers. The same Speakers crop up again and again, so I've set up a page field for them. I'd like to display all the Speakers involved in the Event (basically, 'crawl' all the Topics and retrieve the Speakers, deal with duplicates and display them). And, the Topics are 'grandchildren' of the Events page (since I have other items on the Events page and want to keep things tidy?). Speakers -- Jane Doe -- John Smith -- Bob Jones Events -- Event One (Event Speakers: Jane Doe, Bob Jones, John Smith) ---- Topics ------- Topic 1 (Speakers: Jane Doe, Bob Jones) (assigned with a Multiple Page field from Speakers) ------- Topic 2 (Speakers: Bob Jones, John Smith) -- Event Two ... Once I found out how to access data on a grandchild page, I did used this selector: $speakers = $page->find('template=topic-page')->event_speakers(); That returned an array which when looped gave me this: 1840|1843 1843|1841 So, that's the IDs of the 3 speaker pages, with one duplicate, but I don't know what to do with this! Any ideas folks? Or is there another way that I'm missing? Thanks! Link to comment Share on other sites More sharing options...
Zeka Posted February 3, 2022 Share Posted February 3, 2022 Hi @strandoo Probably, you can handle it by using owner selector. https://processwire.com/blog/posts/processwire-3.0.95-core-updates/ $speakers = $pages->find("template=speaker, speakers_field.owner.parent.parent.name=your-event-name"); Not tested, but should be someshing like this. It's always a bit difficult to grasp, but try to paly with it a little. 3 Link to comment Share on other sites More sharing options...
strandoo Posted February 3, 2022 Author Share Posted February 3, 2022 Thanks @Zeka! I didn’t know about ‘owner’. That sounds awesome. I’ve clocked off for the day (with a large Negroni) but look forward to trying this first thing in the morning. Reading that post was enlightening. 1 Link to comment Share on other sites More sharing options...
strandoo Posted February 4, 2022 Author Share Posted February 4, 2022 @Zeka I had a chance to try this. Your selector worked perfectly, thanks again!. 1 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