This question is for you php guru’s out there. I’m using FF Matrix for each day’s program schedule. The fields are ‘program_start’ and ‘program_end’ (Both are text cell types). The client will be importing from a csv that is already formatted the time as 6:00am. I’ve got the template outputting the data into a table. Now, my goal is to highlight the row of the program that is currently airing. So I figured I would need to use php to determine the start, end, and current times. Then say if “current time is greater than or equal to the start time” AND “current time is less than or equal to the end time” then echo ‘class=“hlght”’.
Usually I can hack my way through bits and pieces found on the web but this one boggles my mind. Here is what I have and it doesn’t work. Can someone please help or give me some sort of direction as to why this isn’t working?
<?PHP
$start = date("Hi", strtotime("{program_start}"));
$end = date("Hi", strtotime("{program_end}"));
$now = date("{current_time format='%H%i'}");
if ($now <= $start && $now >= $end) {
echo "Currently Airing $now";
}
else {
echo "$start - $end Already Aired";
}
?>
And this is what is outputting which is incorrect because the 8:00am - 12:00pm Paid Programming should be the ‘current airing’ show.
12:00am 6:00am Paid Programming 0000 - 0600 Already Aired
6:00am 8:00am ESPNEWS 0600 - 0800 Already Aired
8:00am 12:00pm Paid Programming 0800 - 1200 Already Aired
12:00pm 3:00pm CFL Football - 7/2/09 Winnipeg Blue Bombers @ Edmonton Eskimos 1200 - 1500 Already Aired
3:00pm 4:00pm ESPNEWS 1500 - 1600 Already Aired
4:00pm 4:30pm 3 Wide Life #501 1600 - 1630 Already Aired
4:30pm 5:00pm 2xtreem Motocross #514 1630 - 1700 Already Aired
5:00pm 5:30pm Raceline #157 1700 - 1730 Already Aired
5:30pm 6:00pm Steel Dreams #170 1730 - 1800 Already Aired
6:00pm 8:00pm ESPNEWS 1800 - 2000 Already Aired
8:00pm 11:00pm CFL Football - British Columbia Lions @ Saskatchewan Roughriders 2000 - 2300 Already Aired
11:00pm 12:00am ESPNEWS Currently Airing 0852
Thank you!
