PHP for Pro Events List custom template
Permalink
My question is probably more of a PHP question than a concrete5 or Pro Events question. Not getting much response from stack overflow so trying this forum instead. Please bare with.
I'm using the Pro Events add-on. I've added an Event List block to my page and with the help of someone amazing, created a custom display template. In short, this allows me to lists movies in chronological order using the Event Dates attribute (which captures show dates and times against each movie).
The code which does this is as follows:
The result of this code looks like this:
SUN, 07 AUGUST
11:00 AM The Big Friendly Giant
12:45 PM Finding Dory
*1:30 PM 6:15 PM Poi E - The Story of our Song*
3:00 PM Star Trek Beyond
3:45 PM Ghostbusters
5:30 PM 8:30 PM Suicide Squad
*1:30 PM 6:15 PM Poi E - The Story of our Song*
8:00 PM Jason Bourne
5:30 PM 8:30 PM Suicide Squad
MON, 08 AUGUST
12:30 PM Ghostbusters
1:00 PM 8:30 PM Suicide Squad
3:00 PM Poi E - The Story of our Song
3:30 PM The Big Friendly Giant
5:30 PM Hunt for the Wilderpeople
6:00 PM Star Trek Beyond
8:00 PM Jason Bourne
1:00 PM 8:30 PM Suicide Squad
You'll notice however that on 7 Aug, Poi-E shows at 1:30PM and 6:15PM and Suicide Squad at 5.30PM and 8.30PM. Instead, I do not want the movies to group but the list to be truly chronological, even if it means movie titles repeat.
You'll also notice that Poi-E and Suicide Squad actually displays twice in the listing. Poi-E in the 1.30 and 6.15 slots - but displays as 1:30 PM 6:15 PM, and Suicide Squad in the 5:30 PM and 8:30 PM slots - but displays as 5:30 PM 8:30 PM.
How do I get it to display like the below instead?
SUN, 07 AUGUST
11:00 AM The Big Friendly Giant
12:45 PM Finding Dory
*1:30 PM Poi E - The Story of our Song*
3:00 PM Star Trek Beyond
3:45 PM Ghostbusters
5:30 PM Suicide Squad
*6:15 PM Poi E - The Story of our Song*
8:30 PM Suicide Squad
So I still want the movie to come up twice in the list, but only the relevant time to display ie in the first instance 1.30PM and in the second 6.15PM. I guess in pseudo code I would say something like if there are two time slots, only display the time slot applicable to that position. Okay, that sounds really hard when I say it like that.
I'm really at wits end so any help will be much appreciated.
Thanks,
Choppie
I'm using the Pro Events add-on. I've added an Event List block to my page and with the help of someone amazing, created a custom display template. In short, this allows me to lists movies in chronological order using the Event Dates attribute (which captures show dates and times against each movie).
The code which does this is as follows:
<div class="ccm-page-list"> <?php if (count($eArray) > 0) { foreach ($eArray as $date_string => $event) { extract($eventify->getEventListVars($event)); /*############### Here we lay out they way the page looks, html with all our vars fed to it. This is the content that displays. It is recommended not to edit anything beyond the content parse. Feel free to structure and re-arrange any element and adjust.###############*/ ?> <!--Custom code--> <?php $date_day = date('d, D F', strtotime($date)); if ($cur_day != $date_day) { echo '<div class="movie-list"><h4>'; echo date('D, d F', strtotime($date)); echo '</h4></div>';
Viewing 15 lines of 50 lines. View entire code block.
The result of this code looks like this:
SUN, 07 AUGUST
11:00 AM The Big Friendly Giant
12:45 PM Finding Dory
*1:30 PM 6:15 PM Poi E - The Story of our Song*
3:00 PM Star Trek Beyond
3:45 PM Ghostbusters
5:30 PM 8:30 PM Suicide Squad
*1:30 PM 6:15 PM Poi E - The Story of our Song*
8:00 PM Jason Bourne
5:30 PM 8:30 PM Suicide Squad
MON, 08 AUGUST
12:30 PM Ghostbusters
1:00 PM 8:30 PM Suicide Squad
3:00 PM Poi E - The Story of our Song
3:30 PM The Big Friendly Giant
5:30 PM Hunt for the Wilderpeople
6:00 PM Star Trek Beyond
8:00 PM Jason Bourne
1:00 PM 8:30 PM Suicide Squad
You'll notice however that on 7 Aug, Poi-E shows at 1:30PM and 6:15PM and Suicide Squad at 5.30PM and 8.30PM. Instead, I do not want the movies to group but the list to be truly chronological, even if it means movie titles repeat.
You'll also notice that Poi-E and Suicide Squad actually displays twice in the listing. Poi-E in the 1.30 and 6.15 slots - but displays as 1:30 PM 6:15 PM, and Suicide Squad in the 5:30 PM and 8:30 PM slots - but displays as 5:30 PM 8:30 PM.
How do I get it to display like the below instead?
SUN, 07 AUGUST
11:00 AM The Big Friendly Giant
12:45 PM Finding Dory
*1:30 PM Poi E - The Story of our Song*
3:00 PM Star Trek Beyond
3:45 PM Ghostbusters
5:30 PM Suicide Squad
*6:15 PM Poi E - The Story of our Song*
8:30 PM Suicide Squad
So I still want the movie to come up twice in the list, but only the relevant time to display ie in the first instance 1.30PM and in the second 6.15PM. I guess in pseudo code I would say something like if there are two time slots, only display the time slot applicable to that position. Okay, that sounds really hard when I say it like that.
I'm really at wits end so any help will be much appreciated.
Thanks,
Choppie