
Our DayPI can also be used to build cool Flash widgets to distribute your content. In this case, it was used to build a customizable news index that displays top news and coverage volume for a selection of topics, and reports week-over-week changes in volume. We have a Daylife-hosted free version of the widget up on our Labs site, shown below, that allows users to customize the topic list by filling out a short form.
Branding the widget, and allowing users to interact or generate customized versions, can be a fun way to drive traffic. This widget was used by a blogger at Guardian Unlimited to create a KittieDex, an index of news on cute animals. That version of the widget received 500,000 page views in one week.
The widget works by having the user enter a list of topic names and search phrases. Whenever it loads, it passes the list of topics to a PHP page (topic-dex-data.php) sitting on one of our Daylife servers. It bundles up all of the DayPI calls, and returns an XML file which is processed by the Flash and displayed. For topics that are in the system, it uses the topic_* calls, and for search phrases, the search_* calls. It first gets a count of available articles from seven days ago, and from fourteen to seven days ago, to get the index numbers. Then, depending on the volume of articles, either gets the news for the last 24 hours, or for the last week.
Since the server-side component makes a large number of calls, it uses our batching API. This is not yet documented on our developer site, but the code to use it is in the batcher.php include file. It allows execution of up to 12 calls in parallel.
All of the server-side PHP files necessary for driving the widget are included in the attached newsDexServer.zip file.
| Attachment | Size |
|---|---|
| newsDexServer.zip | 8.5 KB |