The Radio ‘On Air’ Script

Over the past few months I’ve developing the One Media Group (OMG) website for Staffordshire University Students’ Union.

The theme was ‘out of the box’ from ThemeForest and what I’ve done is add some of the functionality and change how it looks a bit.

The main function that I wanted to add to the site was who was on air and how that was displayed on the site.

I’ve worked my good friend and colleague Christopher Smith for several years and what has become known to us as the ‘on air’ script has helped us both massively.

The basis of the script is a text file which contains each day’s schedule. Each line consists of the time the show is on air and the presenter/show name , all separated by pipes. A PHP file then reads this text file and uses the pipes to divide the information up and assigns it to a string which is printed. There are several different files which do different things; one to see what’s on air now and then ones to display a particular day’s schedule.

When we started using the script we would just simply include the relevant files where we wanted them, but now we both work with WordPress and wanted to integrate it a bit better.

Something I wanted to do was use some AJAX to update the on air information without the user refreshing the page. Christopher found the AJAX which the radio station he was working with used to update their now playing song. We modified it slightly and now on the OMG website it is used in the header to display the on air now and next show information.

My code is different from Christopher’s as I wanted to display it slightly differently. The AJAX is reloading a PHP file which has the listen and webcam button as well as includes for the on air now and next PHP files, which read the schedule text file. This file is reloaded on any OMG page every 60 seconds.

Now for the schedule page of the website. I didn’t want to include an iframe in a page entry (like I did last year for Cre8 Radio) as it wasn’t very tidy and was a pain to maintain! So Christopher and I worked together on creating a page template that we could apply to our schedule pages. All I did on the template was include the seven ‘day’ PHP files and styled them so they looked good.

To edit the text file that would contain all the on air information I wanted something that was easy and plain. So I installed CMS from Scratch in a directory and created a single text file that those with the client password could edit. It does take users outside of  WordPress to edit a single file, but I felt this was easier than trying to direct people to the theme editor page within WordPress (mainly because I didn’t want to give them Admin rights to do so!).

However, I wanted to see if there was anything I could add to this. On websites such as BBC Radio 1, where it tells you who is currently on air in the header, it’s also a link to their show page. What if I could do this as well in the header of the OMG website?

I dived back in to the PHP files which were figuring out what the on air text file meant. I was easily able to add another pipe for it to read, which would contain a URL to print. Originally the button span was printed in the file which the AJAX was reading, but I needed to change it so that the span was printed in the on air now PHP file. It was a bit messy for a while as I tried to figure out where things were being printed.

My next thought was ‘what if that presenter/show doesn’t have a page we can link to?’ This required much more work as I figured out what PHP function to use to see if a string was empty. I eventually used the empty function and told it that if it was empty to point the link to the schedule page. On the schedule page, the show links would also display in the presenter and show names.

Another use that I hope to use the show links for is when the news and sports shows are on, is that the link can point to the news and sports pages. Also when we cover Varsity in a couple of months time, those links can all point to our live blogs and Varsity homepage.

  

That’s pretty much what I did over Christmas to enhance the OMG website! I will also be using much of that code and integration for the Cre8 Radio website when it comes back on air in May/June.

All of these changes will be activated once the new branding comes in (which should be within a week or two of writing this).

‘UniQ’ but not necessary

As you may have seen, on Leek Road, Staffordshire University are building a brand new Science and Technology Centre which is part of the £450 million regeneration project ‘UniQ’.

Earlier this evening I was walking along Leek Road to find that the once static a KAM 300 laser sign that said “UniQ” on it was now displaying several messages, including the current time.

It displays “Staffordshire Science Technology” followed by the time. Then “A Unique Solution For A Unique City”, followed by the time. The sequence finishes with “University Quater. UniQ”.

I personally think that this is bad for several reasons:

  • It looks tacky. Having the static UniQ logo was perfectly fine in the dark but now I think it looks like one of those signs that you see on a seaside slot machine arcade.
  • It will distract drivers. It distracted me whilst I was walking! So what would it do to drivers at a very busy junction in Stoke-on-Trent?
  • Is it actually useful? It’s nice to know what a building is, but surely there’s a better way to do it than that! Plus the only real functionality, the time, isn’t even displayed for more than 10 seconds (as you can see from my video).
  • It’s not money well spent. I know that KAM 300 lasers are cheap to keep running but it’s still some money that could be spent elsewhere. (Like making sure that the toilet seats are reasonably comfortable!)

I’m not at all against the UniQ project, I just think that this wasn’t very well thought of. The Stoke campus of Staffordshire University is the ‘creative’ campus and this doesn’t really reflect it. Can they think of something a bit more creative and original please?

For more information on the UniQ project visit www.uniq-stoke.org.

Note: Thanks to Robert Keyes for correcting me that they are not LEDs.

There has been a short response from the university.