Alan-Graham.co.uk The Much More

31Aug/110

Top 40 Uk Charts

So here it is another day, another 8 hours at my computer.  I have been searching for a while for a UK top 40 feed for AcademyFM Thanet's Website that RGOnline do management for.  After hours of searching I came across webcoding.co.uk where a brilliant man has created a script that pulls the UK top 40 from the BBC's Chart page and then returns it as XML.

This is something however I am shocked to see is not made available by the BBC or the Official Charts, it is a simple thing to do for these companies and would make developers lives so much easier.  However i am finally blessed with the ability to have a UK Top 40 Feed in a million and one ways on my websites.

A little on the background of the integration for those who wish to know.  AcademyFM Thanet are a community radio station based in Ramsgate, Kent.  The station asked me to work on their website and after moving the site from their old, ASP written, and appalling CMS into something a little more flexible (modx to the rescue)  I was able to do some work.  It is from here that i have been able to continue work for them and now have their hosting and support contract for the site under RGonline. The top 40 Feed needed to be placed into modx in some way that it was re-usable anywhere .  I investigated the use of FeedX a snippet for parsing XML feeds, however i found it to be quite difficult to configure and never had any success.  So I dropped back to re-inventing the wheel and wrote a custom snippet that controlled and pulled the data. This is all done using SimpleXML and the chunk parsing from the modx API, allowing me to customise the output in a variety of ways. There was only one flaw within the whole of this and that was the structure of the XML.  It looks something like:

 

<chart>

<info></info>

           <chart-item></chart-item>
           <chart-item></chart-item>
           <chart-item></chart-item>
           .......

</chart>

 

This only caused one problem and that was that when looping through the elements using simple XML, the Info tag was the first to be displayed. Essentially a little bit of XSLT could have solved this but not having the time to add this in and get some more simpleXML research, I quickly opted for the poor route to get the code up (10 Points for the first person to guess what I used :( ).

As it happens though the result works and looks smart, although still being faced with a template that I do not like makes me a little resentful of the work.

Anyway for now I will hide, and get rid of the old Top40 Nonsense.

Filed under: Uncategorized No Comments
24Aug/110

Look Mum, I made a blog post

Well I thought it was about time that a blog post was made on this site.  It is a quick moment just to say hello to the world.

I am currently sitting down working on a quick WordPress website for a local business dealing in vehicle body work repairs.  While also trying to prepare for an evening of live sound work (see everything happens all at once).  So before my evening with Gristle Fridge and while writing lines of WordPress template code I thought I would relax with a post.

 

Filed under: Uncategorized No Comments