Mailte Posted August 4, 2015 Share Posted August 4, 2015 Hi everyone, I'm trying to get some Dates sorted from a repeater field called "dates" which includes the fields "date" and "duration". Now i want to get the field "date" sorted by date. Cant get along with find("sort=date"), cause I don't know how to find a field input from a repeater. Here's what I got now: $trainings = $pages->find("template=training_single"); foreach($trainings as $t){ $datesrepeater = $t->dates; foreach($datesrepeater as $date){ echo $date->date; } that outputs the dates, but how can i get them sorted? Thanks for your answers Malte Link to comment Share on other sites More sharing options...
mr-fan Posted August 4, 2015 Share Posted August 4, 2015 Welcome Malte to the processwire forums... there are some more topics on this with codeexamples and working options for date fields in repeater items. Have a look at: https://processwire.com/talk/topic/4933-sorting-events-by-date-with-multiple-event-dates-stored-in-repeaters/ https://processwire.com/talk/topic/2884-sorting-based-on-repeater-field-values/?p=28445 Regards mr-fan Google Search the forum is much more better than normal forum search... Link to comment Share on other sites More sharing options...
Mailte Posted August 4, 2015 Author Share Posted August 4, 2015 Thanks a lot! I didn't find that post. Thanks for you tip. Came up with this: $today = date('d.m.Y'); $events = new PageArray(); $items = $pages->find("template=repeater_dates, date>=$today, sort=date, include=all"); foreach($items as $item) { echo $item->date; echo $item->parent->title;} works fine for me 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