Jump to content

Repeater Fields and grouping order


xporter
 Share

Recommended Posts

First of all, I would like to thank you all for such great documentation and community.  I have just started developing 5 days ago and I have completed some really difficult programming relatively easily.  But, I do have a quick question. The site I am developing has an events listing that links to events that have a possibility of multiple dates.  That was easy.  But, now I have to create the schedule listing and the events could look like this:

Monday, Nov. 3rd

10:00 am   -  Event 1

11:30 am   -  Event 2

Tuesday, Nov. 4th

12:00 am   -  Event 1

So, to achieve this, I create a repeater field for the event date and time.  I created the functionality for the schedule and have the events sorted by date but if the event has multiple dates and times, I cannot figure out how to pull the second date and time out and then list the event again.  I thought about doing a recursive function that traverses the page array and pull out each event and date/time, putting it into a new array, sorting it and then doing the schedule.  But that just seems like overkill and I am little rusty with my PHP.  Does someone have something like this or do I need to rethink this?

Link to comment
Share on other sites

Thanks for the reply but the same problem I have now I may have with it.  If there are multiple days and times for one event, how would I logically put that into a schedule with the format I presented before?  Basically, I am listing the event more than once based upon what is entered into the repeater fields for event date AND not right after each other but rather after other events in an array that may have an event date.

For example, Event 1 happens on Nov 4th and Nov 6th.  But Event 2 happens on Nov. 5th.  I am using a repeater field for event dates.  How do I put Event 2 in between both Event 1 dates?  

Thanks!

Link to comment
Share on other sites

The easiest way would be to select all repeater-fields which contain the date, sorted by it. With "$event = $repeaterPage->getForPage();" you can than get the corresponding event (kind of the parent of the repeater) for each of the dates.

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

×
×
  • Create New...