Touch the firehose of ds106, the most recent flow of content from all of the blogs syndicated into ds106. As of right now, there have been 92407 posts brought in here going back to December 2010. If you want to be part of the flow, first learn more about ds106. Then, if you are truly ready and up to the task of creating web art, sign up and start doing it.

SIMILE RAGE

Posted by
|

About a week ago, Martha set me on the task of fixing up the SIMILE Timeline plugin so Prof. McClurken’s History of the Information Age class could add posts with BC dates to the timeline. (Previously, the plugin was only allowing posts for 1000 <= year <= 3000. For whatever reason.) In keeping with a (presumably) time-honored tradition here at DTLT, now that I’ve finished my task I get to blog about it.

Now, SIMILE Timeline itself will allow dates in whatever range you want, backwards and forwards of AD 1, so we needed to modify the plugin to take advantage of it. SIMILE Timeline reads an XML document and gets its dates from there. Here’s a sample:

<event start="2003-04-02T00:00:00+00:00" title="Entry Title 2003" link="Link to the entry" icon="" color="#58A0DC">[CDATA[ This is the description. ]]
</event>
<event start="500 BC"  title="Entry Title -500" link="Link to the entry" icon="" color="#58A0DC">[CDATA[ This is the description. ]]
</event>
<event start="1980-04-02T00:00:00+00:00" title="Entry Title 1980" link="Link to the entry" icon="" color="#58A0DC">[CDATA[ This is the description. ]]
</event>

See where we have “500 BC?” That’s how SIMILE Timeline recognizes BC dates. The plugin can read either from an RSS feed or from the individual posts on a blog. Originally, we had had -0500-04-02T00:00:00+00:00, since that’s the ISO-8601 date string representing April 2, 500 BC. That didn’t work for this plugin, so once we divined that the XML needed to say “500 BC” instead (and that was a matter of writing the XML output to a file in a writeable directory on the server), I edited the RSS document to say 500 BC and the plugin to check for the “BC” substring and output that.

Of course, that wasn’t enough, and ultimately Martha got the idea of using a WP Custom Field. Does the post describe a BC date? If yes, then you enter “true” into the custom field “bc.” Then the plugin checks if the “bc” value is true, and if it is, strips the year out of the date string and echoes “500 BC” to the XML document. Voila. We can edit this plugin for ranges, too, but that’s secondary. For right now, we’re golden. The hurdle is cleared. After eight hours of beating my head against the wall, we solved it in 6 lines of code.

Add a comment

ds106 in[SPIRE]