Over the last few days, supported by the backstage.bbc.co.uk project, I have been developing some PHP scripts that will read in the BBC's world news RSS feed and present the news, story-by-story in XHTML+SMIL.
At present, to the best of my knowledge, only Microsoft's Internet Explorer (theoretically version 5.5 or greater, but only tested in 6) is compatible (See below).
about xhtml+smil
The software is actually written based on Microsoft's HTML+TIME profile on the MSDN website. HTML+TIME has since evolved into the XHTML+SMIL note to the W3C's SMIL 2.0 specification, and thence to the comments on integrating SMIL with XHTML in the W3C's SMIL 2.1 Candidate Recommendation. Put simply, XHTML+SMIL (or whatever you want to call it) is a highly probable future web technology, but not yet well enough supported by browsers to make it practical for everyday design purposes.
Over the last two years, I have played with XHTML+SMIL off and on to see what it is possible to do. This work is very much a continuation of my passing interest. It is not designed, therefore, to be anything immensely practical: I see it as a proof-of-concept type idea looking towards a possible future of the web.
screenshot
about the player
The player uses a small amount of JavaScript to launch the daughter window the correct size, to control and update the clock and to pause the stories either after clicking the pause button or while hovering over a link on the page. All other features are written in XHTML+TIME. Each story is displayed for 6 seconds, and a <meta refresh> tag makes the feed reload every twenty minutes.
- Headline - The headline is the content of the <title> for each feed item.
- Story - The story is the content of the <description> for each feed item.
- Read More - This link points to the content of the <link> for each feed item.
- Updated - The updated time is the content of the <pubDate> for each feed item.
- Map - The map area shows either the part of the world, the country in the UK, or a theme (such as 'business'), determined from the link URL. If the story was last updated within the last 20 minutes, however, a 'breaking news' logo is shown instead.
- Location - ('World | South Asia' on the screendump above.) This is the value between /hi/ and /xxxxxx.stm, as parsed from the content of the <link> for each feed item.
- Google News - This link only returns useful results about 66% of the time but is intended to provide a way of accessing the story from other news services. It uses the story headline for each item, and then generates a list of keywords by removing from the headline the top 150 most common English words.
- Pause button - Stops the story from changing. The button changes to a 'play' button when the player is in pause mode.
possible future work
- Cache the results of the parsing locally on my server for ten minutes or so, so that it reduces my bandwidth and processor time.
- Allow users to send GET requests to the player, specifying the number of seconds to show each story for, and possibly allowing them to add local news or other BBC News feeds to the player.
- Come up with a better content analysis method to make the Google News (and other links too?) more accurate.
source code
The PHP Source code for some of the functions that make up the player are linked below. The source is released under the terms of the General Public Licence.
- bbcLinkLocation() - Takes a BBC News URL, and returns the section between the /hi/ and xxxxxx.stm
- bbcCheckStoryAge() - Takes the value of an RFC-822 formatted date (such as the <pubDate>) and returns true if the story is less than x minutes old, otherwise false.
- getHeadlineKWs() - Takes a text string and checks each word against a separate file, and removes words in the text string if they occur in that separate file. This is used in the player to create the Google News search term from the news headline. The separate file I use is the top 150 most common English words, according to the FLOB corpus of British English, but for copyright reasons I cannot reproduce the list here.
- rssToArray() - Converts an RSS feed into an array for PHP. Note that there are much better ways of doing this than the one here, but I am providing this code (which I wrote some 18 months ago) as the array returned is the format necessary for many of the other functions here.
- pauseNews() and resumeNews() - JavaScripts which stop the news stories from changing.
- The main bit! - Converts each item in the array to XHTML+SMIL. All of the other functions on this page are prerequisties for this code, of course.
Note that I cannot give support on any of these functions, but I hope that using them or basing your ideas on them might save you some time! I'd be interested to hear what use you put them to.
Trademarks on this page acknowledged