Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    1
    Member #
    29324
    Many thanks for the support. Issue resolved.
    Last edited by Dylan Parrin; Oct 18th, 2015 at 06:42 AM.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,980
    Member #
    5580
    Liked
    761 times
    Dylan ...

    You need a database that contains the complete weekly or monthly radio schedule.
    It could be a MySQL database, or as simple as a plain text database.

    Here is an example of a simple text database ... perhaps you call it "schedule.txt" ...

    SHOW NAME|DESCRIPTION|DJ|DJ PAGE|DAY|START TIME|END TIME|

    Music Machine|Hear the greatest hits!|Graham Percival|graham|MON|13:30|18:29|
    Jerry's Jazz Show|Sounds of Jazz|Jerry Davis|jerry|TUE|18:30|23:59|

    Each timeslot has a line to itself, with the variables separated by pipes |

    PHP opens that text file and loads the lines into an array.
    You explode each line by pipes into another array.

    You set the server to a known timezone, and you already know the current time:
    $now=time();

    $now becomes a UNIX timestamp, like 1201452452

    As you loop through the lines, you convert those times to timestamps and find out
    where your $now time fits into the day and time of a particular line.

    You know what is playing "now", and you can figure out what is coming "next".

    Here is a radio site I did for a "soul music" station in England. You can actually
    pick your own timezone so the schedule reflects your clock, not theirs. The only
    part I did for this site was the "who's on now", the schedule, and the "presenters".
    All done using flat files, or Google Docs spreadsheet.

    The site owners go into Google Docs and administer the schedule and presenters.
    http://www.starpointradio.com

    You didn't mention your experience with PHP ... your technical level?

    .


  4. #3
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,980
    Member #
    5580
    Liked
    761 times
    I'll tell you what ...

    You create the database in this format:

    DAY|START TIME|END TIME|SHOW NAME|DESCRIPTION|DJ|DJ PAGE|

    MON|13:30|18:29|Music Machine|Hear the greatest hits!|Graham Percival|graham|
    TUE|18:30|23:59|Jerry's Jazz Show|Sounds of Jazz|Jerry Davis|jerry|

    Let's put the day and times first, because it's easier to see and edit.
    Save it as "schedule.txt" and post it for me in the private message (conversation) area.

    Once I have the "schedule.txt" file to use, I'll whip-up a PHP script to display "who's on",
    and "Coming-up". If you have a JPG image of the DJ, you can add that field to the database,
    (the JPG filename and path).

    If you're going to have someone at the station update the schedule, you can get a free
    Google Docs account and create your database there (as a spreadsheet). If you do that,
    let me know in the private conversation area. You can add my Google Docs email to the
    permissions list, and I can edit the spreadsheet also. The person at the radio station gets
    a free Google account and they can edit the spreadsheet too.

    Either way is fine, but you have to decide who is updating or editing the schedule.

    .


  5. #4
    Junior Member
    Join Date
    Oct 2011
    Posts
    10
    Member #
    29470
    How do you plan to make it effective to users already at your site before scheduled time? Going to use cron+ajax?

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,980
    Member #
    5580
    Liked
    761 times
    Maslan ...

    Dylan is using Google Docs for the site owners to edit their own radio program schedule.
    Their website uses a Google Docs Spreadsheet to display "currently on air", and "coming up next" ...

    See it on this new radio station (still under development): http://www.castlemeadradio.co.uk/

    There are no CRON jobs needed.
    The Google Docs Spreadsheet also contains the URL for the JPG image,
    but I see they have not entered those in yet. [X] placeholders for images.

    For sites that don't wish to use MySQL, yet have an easy way for clients to manage data,
    Google Docs seems to be a really good way to go. It's free, and the Doc owner can assign
    permission to any other Google accounts. For spreadsheets, lists, text content, etc.


  7. #6
    Junior Member
    Join Date
    Oct 2011
    Posts
    10
    Member #
    29470
    I see, very nice tool.
    Thnx for information mlseim.

  8. #7
    Junior Member
    Join Date
    Oct 2011
    Posts
    1
    Member #
    29545
    mlseim, very useful advice you've provided.

    Just wondering how quite can I integrate a google docs spreadsheet into the php? I'm actually looking to do the exact same thing as Dylan!

  9. #8
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,980
    Member #
    5580
    Liked
    761 times
    I started a private conversation, because you have to give me some sensitive information.
    I'll walk you through it as I have free time throughout the day.

    You basically add me (my google account) to your spreadsheet user manager.
    Later, you can remove me ... after I show you what to do.

    See the private conversation I started.


  10. #9
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,980
    Member #
    5580
    Liked
    761 times
    For those playing along, let's go over how the Google Docs works. You set up a free Google account, and then create a new doc, spreadsheet, or whatever you're using. In this case we are using a spreadsheet to create a radio program schedule.

    When you have some data, you will publish it.
    Click File and then Publish.



    Next Screen



    Now this is the interesting part ... you can have the data published in different formats. Which one you use is up to you, depending on how you want to use the data.

    I like to use the RSS format. They can provide the data as HTML, CSV, etc ...but, they also have some formats they don't show. Later, you'll see how to affect the data format. But for now, we'll pick RSS.



    The important part is the long code of random numbers and letters. I erased them here so they don't show. You'll want to copy and paste that long random key code into your clipboard.

    I like to get the data in the form of cells ... so I create an array of the whole spreadsheet.
    The array is two dimensional -- Rows (lines) X Cells (columns)

    Here is the basic script to build the array from the spreadsheet:
    PHP Code:
    <?php
    // Building an array from Google Docs Spreadsheet

    // Setting my own timezone in case I want to
    // do date and time calculations.
    $default="America/Chicago";
    date_default_timezone_set($default);

    // What time is it right now ...
    // Here just in case I need to know this later on.
    $now=time();
    $year=date("Y");
    $month=date("m");
    $day=date("d");
    $dow=strtoupper(date("D"));

    // Now, I want to grab the data by "feeds" ... in the format of "cells".
    // This part is not very well documented in Google, but it shows up
    // in the documentation for API developers.
    // The important part is to use this link (shown on the $data line) all the time, but change the
    // long random key code to reference your spreadsheet.  The same long code
    // they show when you get code for publishing the site.
    // The URL to the Google Spreadsheet - This is the URL for the PHP script (feeds/cells), not the public URL ...
    $data "http://spreadsheets.google.com/feeds/cells/0AkJL1693vz0AlVL169xMkSkN0AlVL169xMNISlNkSkNFYlE/1/public/basic";

    // Get the Google Docs Spreadsheet
    $curl curl_init();
    curl_setopt($curlCURLOPT_URL,"$data");
    curl_setopt($curlCURLOPT_RETURNTRANSFER1);
    curl_setopt($curlCURLOPT_CONNECTTIMEOUT0);
    $result curl_exec($curl);
    curl_close($curl);
    $xml_result simplexml_load_string($result);

    // Build an array of the spreadsheet
    $build=array();
    foreach (
    $xml_result->entry as $item) {
    $col=ord(substr($item->title,0,1))-65;
    $row=substr($item->title,1);
    $build[$row][$col]=$item->content;
    }
    // Let's remember the last row.
    $rend=$row;
    // how many lines in the array.
    $count=count($build);

    // Just a quick test to see if it works.
    // We'll display the first column.
    for($i=2;$i<=$rend;$i++){
    echo 
    $build[$i][0];
    }

    // That's it for now ... building the array.
    // What you do with the array will be different for each script.

    ?>
    That's enough for this post ...
    Enough to get you started.

    .


  11. #10
    Junior Member
    Join Date
    Oct 2012
    Posts
    8
    Member #
    33463
    Liked
    2 times
    I know this thread is really old, but I have a similar question. Is it possible to display a certain page/url on a certain day in a website.

    If it helps I use WordPress and was thinking maybe there was a PHP query that could call a certain url or blog/page from the website on a certain day.

    Thanks!


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:41 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com