For those that have beeing following (or not) the Learning Object experiment’s here (see Back to TrackBack), we have applied the MovableType Trackback concept to every item in the Maricopa Learning eXchange.
With some time to tinker today, I cooked up a new trackback summary tool that allows one to check out the trackbacks across our site. It is ugly, ugly code, a very un-elegant hack, but it is a concept that can illustrate (maybe) what the potnetial is for TrackBack and Learning Objects.
So what?
What Trackback means here is that every MLX item (see one example) has emdedded code (RDF tags) that allows it to be “autodiscovered” by emerging web tools, and existing ones such as the MovableType Bookmarklet (see our BlogShop description).
This means that such tools allow applications to automatically register a “ping” record with the MLX object each time someone blogs about it.. Now here is the kicker- the object/item itself in our MLX now has a record connecting it to those that have written/blogged about it.
You can see the Trackbacks for every item in the MLX, but there is no way to see what is going on across the system .Hence the reason for coding a Quick and Ugly Track Back Summarizer.
So here is what it does. First, I added a field to the database for each MLX package to record the count of TrackBack pings registered to it (default is 0, duh). Then, the task was to create a “cron” script (one that runs automatically according to some settings files) that would update the database.
This tb_count PHP script merely walks the directory where the Stand Alone TrackBack script stores its data. First, I took a sloppy approach, and scanning the data files which are named:
- xxx.stor
- yyy.stor
where xxx and yyy are the TrackBack id numbers (which on our system are set to match the package id). Thus, to count the pings, I simply found a text string that is listed for each entry, and used the unix grep command to get a count of the occurrences of “blog_name”. I modified it later to use the OnyxRSS parser we already use on the RSS2JS script to do an item count on the tb_rss/xxx.xml files
Then, I just saw a cleaner approach that walks the .rss files. I made some slight modifications in Antonio’s script to take as an the path to the XML file, to use “++” for variable incrementation, and removing a redundant “else” clause.
So I end up with an array of the file names, which I can loop over, extract the id, and then update the appropriate record in the database with the number pings for each. The guts of the code are provided as tb_count.txt
We already have an update cron script that takes care of our RSS feeds. This is nothing more than a text file with a list of commands, each using
curl http://xxx.mcli.dist.maricopa.edu/somescript.php/
to run a PHP script remotely (note that fake URLs, the script addresses are secret).
So now I have a method of updating the trackback counts on a regular database, so it was a matter of coding the new Track Back Summarizer to pluck all of the non-zero trackback countrs from the database, and generate some output. For fun, we calculate the number of packages with trackbacks (now a whopping 6) and the total number of pings (11, wow!) registered on the server.
The output is set up to be able to view the lists in order of most pings, title of item, or is of the item. Eventually it would be set up to list perhaps 10 at a time once the world starts Trackbacking us all over the place.
I can also quickly add the trackback count to the MLX item display (well as soon as my primary laptop finishes burning a DVD).
Okay, this is more of a utility, and ended up being a code exercise to get back to PHP and mySQL after plunging too much time into presentations. But maybe D’Arcy will be interested as he has set up the same TrackBack system up at CAREO.
It took about 10 minutes to add the count of Trackback pings to every MLX package, e.g.
http://www.mcli.dist.maricopa.edu/mlx/slip.php?item=278
It would have been less, except for stupid things like misspelling “Trackback”