Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 47
  1. #21
    James's Avatar
    Title
    Administrator
    Join Date
    Jan 2008
    Location
    Melbourne, Australia
    Posts
    12,182
    Rep Power
    10
    Looks good, although Im not sure if you intend to name your shows "Monday", "Tuesday" etc..
    You have replaced a comment with "80s".

  2. #22

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    ok how about now, as i have sorted it out. i can do the rest like add colour etc



    <?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' => "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 < count($shows); $i++) {
    if($shows[$i]['day'] == $now_day && $shows[$i]['start_time'] >= $now_time && $shows[$i]['end_time'] < $now_time) {
    $output = array($shows[$i]['show_name'], $shows[$i]['image']);
    }
    }


    return $output;


    }
    ?>
    DJ Now On Air: <br />
    <img src="<?php echo onAirNow()[1]; ?>"><br />
    <h3><?php echo onAirNow()[0]; ?></h3>

  3. #23
    James's Avatar
    Title
    Administrator
    Join Date
    Jan 2008
    Location
    Melbourne, Australia
    Posts
    12,182
    Rep Power
    10
    Great, working well now?

  4. #24

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    i will test it on our website and let you know

  5. #25

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    just gives me this page is not working when i put this script up

    <?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' => "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 < count($shows); $i++) {
    if($shows[$i]['day'] == $now_day && $shows[$i]['start_time'] >= $now_time && $shows[$i]['end_time'] < $now_time) {
    $output = array($shows[$i]['show_name'], $shows[$i]['image']);
    }
    }


    return $output;


    }
    ?>
    DJ Now On Air: <br />
    <img src="<?php echo onAirNow()[1]; ?>"><br />
    <h3><?php echo onAirNow()[0]; ?></h3>

    you try http://urban-radio.co.uk/test.php

  6. #26
    James's Avatar
    Title
    Administrator
    Join Date
    Jan 2008
    Location
    Melbourne, Australia
    Posts
    12,182
    Rep Power
    10
    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):
    Code:
    <?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' => "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 < count($shows); $i++) {
    if($shows[$i]['day'] == $now_day && $shows[$i]['start_time'] >= $now_time && $shows[$i]['end_time'] < $now_time) {
    $output = array($shows[$i]['show_name'], $shows[$i]['image']);
    }
    }
    
    
    
    
    return $output;
    
    
    
    
    } 
    ?>
    DJ Now On Air: <br />
    <img src="<?php echo onAirNow()[1]; ?>"><br />
    <h3><?php echo onAirNow()[0]; ?></h3>

  7. #27

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    yep now its working i have also added colour to the text as well thank you very much

  8. #28

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    thing is now when the dj is on the air will it automatically change the image instead of having to refresh the page?

  9. #29

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    nochange.jpg the image has not changed, whats going on what am i doing wrong?

  10. #30

    Title
    Junior Broadcaster
    Join Date
    Oct 2012
    Location
    UK
    Posts
    86
    Rep Power
    7
    anyone here to help?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •