V7dev Posted March 27 Share Posted March 27 I can't find anything specific in my searches, so I figured I would ask for some guidance! So I have a repeater field that I'm trying to search for outside a page. Here's my structure: Home Events (events template) Event (event template) Part One (event_day template) Repeater (named event_schedule) Event Start Date (event_start_date) etc... Part Two etc... Speakers (speakers template) So from the speakers template I'm trying to access the repeater with the following: $pages->find("template=event_day, event_schedule.speakers={$page->id}"); How do I access the actual fields inside the repeater, for example, the above dumps the following, which is correct, just can't access the event_start_date field? Let me know if there's more info needed. Thank you! Link to comment Share on other sites More sharing options...
ngrmm Posted March 27 Share Posted March 27 @V7dev you just need a loop $items = $pages->find("template=event_day, event_schedule.speakers={$page->id}"); foreach($items as $item) { foreach($item->event_schedule as $repeater_item) { echo $repeater_item->event_start_date; } } 2 Link to comment Share on other sites More sharing options...
V7dev Posted March 27 Author Share Posted March 27 19 minutes ago, ngrmm said: @V7dev you just need a loop $items = $pages->find("template=event_day, event_schedule.speakers={$page->id}"); foreach($items as $item) { foreach($item->event_schedule as $repeater_item) { echo $repeater_item->event_start_date; } } So that's what I was missing, thanks so much! 1 Link to comment Share on other sites More sharing options...
ngrmm Posted March 27 Share Posted March 27 @V7dev in case you wonder, why you do not see the repater in you dump. Repeaters are pages themself linked to your actual page Also see here for more options to get the repeater items: Link to comment Share on other sites More sharing options...
V7dev Posted March 27 Author Share Posted March 27 $items = $pages->find("template=event_day, event_schedule.speakers={$page->id}"); foreach($items as $item) { foreach($item->event_schedule as $repeater_item) { echo $repeater_item->event_title . '<br>'; } } It will echo out all the repeaters for that page, even though the speaker is only in one of them? What's the point of the first portion ($items) if you have to make another exception to see if the speaker is in the second foreach loop?Apologies for perhaps not seeing the forest from the trees! 1 Link to comment Share on other sites More sharing options...
Edward Ver Posted October 4 Share Posted October 4 (edited) Opp wrong post Edited October 4 by Edward Ver 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