Noticing the variety in popularity amongst the different topics that the pieces on this site cover, I added a "Most Popular Entries" sidebar to keep track of what people are reading. This is done with a simple application of Apache::ParseLog, XML::RSS, movabletype's XML-RPC interface and a movabletype plugin.
Every night after midnight, hits.pl runs and inspects the previous day's Apache access log. Every entry has a predictable URL of the form http://www.hackdiary.com/archive/000articleID.html, so the code looks for hits on those URLs and parses out the article ID. It updates a dbm file, adding the day's hits to hits already recorded for each item.
After that's finished, hits2rss.pl is run and translates the dbm file into an RSS file by looking up the article titles via the MT XML-RPC interface. An MT plugin parses that file when the index page is rebuilt and makes the sidebar.
Fun hacks like this make me wish that MT had a license that allowed distribution of modifications to its core. Although the plugin interface is flexible, it's a dead-end in the long run without the ability to dig in and change things under the skin.
perl rss Posted by Matt Biddulph at April 1, 2003 06:23 PM
→ hebig.org/blog: Movable Type News Roundup
→ hebig.org/blog: Movable Type News Roundup
Perfect,
http://www.kenankara.com
Posted by: Kenan KARA on August 7, 2003 06:59 PM