radio on air script help

hello all, first time poster…have borrowed an on air script from another radio station (permission granted but they will not give coding support) and it is working, my question is will it cover each day of the week? I tried putting individual days in and it broke the code. So is it set up for weekdays and then the weekend? Please take a look and make suggestions. I’d like to make sure it displays my images each day. Thanks for your help!

[php]<?php
//set timezone
putenv (‘TZ=America/Chicago’);
mktime(0,0,0,1,1,1970);
$day = date(“N”);
$time = date(“Hi”);
if ($day == 7)
{
switch($time)
{
case ($time >= ‘0000’ && $time <= ‘0459’):
echo"";
break;
case ($time >= ‘0500’ && $time <= ‘0600’):
echo"";
break;
case ($time >= ‘0600’ && $time <= ‘0900’):
echo"";
break;
case ($time >= ‘0900’ && $time <= ‘1200’):
echo"";
break;
case ($time >= ‘1200’ && $time <= ‘1400’):
echo"";
break;
case ($time >= ‘1400’ && $time <= ‘1600’):
echo"";
break;
case ($time >= ‘1600’ && $time <= ‘1900’):
echo"";
break;
case ($time >= ‘1900’ && $time <= ‘2100’):
echo"";
break;
case ($time >= ‘2100’ && $time <= ‘2400’):
echo"";
break;

    default:
        echo"<img src='http://southwestarkansasradio.com/images/Foxsportsradiologo.jpg' alt='On-Air Now' class='onair'/>";
        break;
}

}
elseif($day == 6)
{
echo"KNAS";
}
else
{
switch($time)
{
case ($time >= ‘0000’ && $time <= ‘0459’):
echo"";
break;
case ($time >= ‘0500’ && $time <= ‘0600’):
echo"";
break;
case ($time >= ‘0600’ && $time <= ‘0900’):
echo"";
break;
case ($time >= ‘0900’ && $time <= ‘1200’):
echo"";
break;
case ($time >= ‘1200’ && $time <= ‘1400’):
echo"";
break;
case ($time >= ‘1400’ && $time <= ‘1600’):
echo"";
break;
case ($time >= ‘1600’ && $time <= ‘1900’):
echo"";
break;
case ($time >= ‘1900’ && $time <= ‘2100’):
echo"";
break;
case ($time >= ‘2100’ && $time <= ‘2400’):
echo"";
break;
}
}
?> [/php]

Hi,

This code output different image, depending on day of week and also time of day. Short answer is - yes, it covers all days of week.
Here is your code “shortened” and with comments:
[php]if ($day == 7) // Sunday
{
// … shows different image depending on time
}
elseif($day == 6) // Saturday
{
// … shows the same image, regardless of time
}
else // ALL Weekdays
{
// … shows different image depending on time
}[/php]

thanks!

hi the code above where does that go in the script at the top of the page ?

djclewes,
It is already in the code. The code first posted breaks down days and hours and places a different DJ’s picture depending on the day/time. Not a very good way to do it, but, I am sure it works.

Sponsor our Newsletter | Privacy Policy | Terms of Service