Jump to content

on air script


djaubs89
 Share

Recommended Posts

You are missing brackets in between the shows in the array. Its not valid PHP.

Please wrap your code in CODE tags for ease of readability and unicode support.

 

This should work (Playground: https://www.tehplayground.com/r15xCfmk1wcOzRuF):

// http://broadcastingworld.com/




// Set the timezone
// See full list of timezones here: http://php.net/manual/en/timezones.europe.php
date_default_timezone_set('Europe/London');




// Set default text and default image | When a show is not on air, this text and image will display
$default_on_air = 'No DJ is on air'; // Default text
$default_image_on_air = 'http://urban-radio.co.uk/images/jukebox.gif'; // Default image




// Shows array, edit this information for each show
$shows = [
[
'show_name' => "JukeBox", // jukebox
'day' => "Monday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 01, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/jukebox.gif'
],
[
'show_name' => "JukeBox", // jukebox
'day' => "Tuesday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 01, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/jukebox.gif'
],
[
'show_name' => "JukeBox", // jukebox
'day' => "Wednesday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 01, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/jukebox.gif'
],
[
'show_name' => "JukeBox", // JukeBox
'day' => "Thursday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 01, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/jukebox.gif'
],
[
'show_name' => "80's Request", // 80s
'day' => "Friday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 18, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'
],
[
'show_name' => "80's Request", // 80s
'day' => "Friday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 18, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'
],
[
'show_name' => "80's Request", // 80s
'day' => "Saturday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 18, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'
],
[
'show_name' => "80's Request", // 80s
'day' => "Sunday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)
'start_time' => 18, // Start Time (24 hour format)
'end_time' => 20, // End Time (24 hour format)
'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'
]
];




/////////////////////////////////////////////////////
////////// DO NOT EDIT BELOW THIS LINE //////////////
/////////////////////////////////////////////////////




$now_day = date('l');
$now_time = date('G');




$output = array($default_on_air, $default_image_on_air);




for($i = 0; $i if($shows[$i]['day'] == $now_day && $shows[$i]['start_time'] >= $now_time && $shows[$i]['end_time'] $output = array($shows[$i]['show_name'], $shows[$i]['image']);
}
}




return $output;




} 
?>
DJ Now On Air: 

<?php echo onAirNow()[1]; ?>

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

PHP is a server side language that will execute the script to fetch the DJ on air. The script will only load the DJ on air upon page load. As in, if you load the page at 17:59, and the click goes to 18:00, the DJ on air will not update.

 

You asked for a solution to have your website automatically refresh the DJ on air so you wouldnt have to refresh the page when the click ticks over. For this, you need a front-end language such as Javascript/JQuery to tell it to fetch the current dj on air every 30 seconds (or thereby).

 

The script you have now works fine, it will display the DJ on air when a user visits your website. But if you want it to automatically update the DJ on air without the page refreshing, you will need to use JQuery to make that happen.

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

ok think i have it

 

 

 

 

 

 

 

<?php function onAirNow() {// James' Show On Air Script

// http://broadcastingworld.com/

 

 

 

 

 

 

 

 

// Set the timezone

// See full list of timezones here: http://php.net/manual/en/timezones.europe.php

date_default_timezone_set('Europe/London');

 

 

 

 

 

 

 

 

// Set default text and default image | When a show is not on air, this text and image will display

$default_on_air = '

No DJ is on air'; // Default text

$default_image_on_air = 'http://urban-radio.co.uk/images/jukebox.gif'; // Default image

 

 

 

 

 

 

 

 

// Shows array, edit this information for each show

$shows = [

[

'show_name' => "JukeBox", // jukebox

'day' => "Monday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 01, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/jukebox.gif'

],

[

'show_name' => "JukeBox", // jukebox

'day' => "Tuesday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 01, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/jukebox.gif'

],

[

'show_name' => "JukeBox", // jukebox

'day' => "Wednesday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 01, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/jukebox.gif'

],

[

'show_name' => "JukeBox", // JukeBox

'day' => "Thursday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 01, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/jukebox.gif'

],

[

 

 

],

[

'show_name' => "80's Request", // 80s

'day' => "Friday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 18, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'

],

[

'show_name' => "80's Request", // 80s

'day' => "Saturday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 18, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'

],

[

'show_name' => "80's Request", // 80s

'day' => "Sunday", // Day (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday)

'start_time' => 18, // Start Time (24 hour format)

'end_time' => 20, // End Time (24 hour format)

'image' => 'http://urban-radio.co.uk/images/strawbs.jpg'

]

];

 

 

 

 

 

 

 

 

/////////////////////////////////////////////////////

////////// DO NOT EDIT BELOW THIS LINE //////////////

/////////////////////////////////////////////////////

 

 

 

 

 

 

 

 

$now_day = date('l');

$now_time = date('G');

 

 

 

 

 

 

 

 

$output = array($default_on_air, $default_image_on_air);

 

 

 

 

 

 

 

 

for($i = 0; $i

if($shows[$i]['day'] == $now_day && $shows[$i]['start_time'] >= $now_time && $shows[$i]['end_time']

$output = array($shows[$i]['show_name'], $shows[$i]['image']);

}

}

 

 

 

 

 

 

 

 

return $output;

 

 

 

 

 

 

 

 

}

?>

DJ Now On Air:

 

<?php echo onAirNow()[1]; ?>

 

<?php echo onAirNow()[0]; ?>

 

 

Link to comment
Share on other sites

  • 9 months later...

You've asked this question many many times and IF the answers haven't sunk in by now then that's NOT our fault....

 

I'm imagining a lot of people around here are getting just a tad bored with your pathetic repetitive questions...

 

I'm going to suggest to James that he locks this thread

Link to comment
Share on other sites

This topic is started at April 8, 2017

 

 

James, the founder of BW has provided several scripts, links and details about several scripts

He even provided a script to show "the online dj"

James is a "tech guy" ... when he writes a script, it gonna show everyone the right content.

rite one last question, how would that code show when my dj's are online as well

I beg You and fellow (new) members to "read" what is written, to test Yourself scripts, to discover the download area of your stream provider ... and "to learn" how things are working.

 

 

We as alltime members, since 2008 / 2009, to BW have learned through the years with ups and downs how scripts are acting, are working, where they can be found, how to adjust them etc ...

Most of Us are selfmade people since decades (I am into broadcasting since 1978, so been there - done that).

Before these kind of forums about broadcasting were online We had to "find" at any place possible "some info" to what We were searching for.

 

So please, understand Our point of view as pro and former pro broadcasters, including every hobby broadcaster that "searching & learning" isn't a shame.

However please do not ask at all time the same or similar questions.

Use the "search" tool at this website !!

Since BW is founded in 2008, and in earlier days at other forums, We have seen these kind of questions very very very often.

 

If some members do not want, or are not able to read the answers, I suggest that kind of people to stop with their broadcasting "dream".

 

Last but not least ...

At this link You can find the "online dj" script provided by James ... Please read it, learn it & use it !

https://www.tehplayground.com/PLFCyp96cBBFRtBL

 

Hereby this thread is closed

  • Thanks 1

Visit and listen @ BW !

http://i.imgur.com/Ggmw4ub.gif

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...