Share and enjoy. (The "OTD" is "On This Day.")
This is a pure Perl MT plugin version of some template code I had written with Brad Choate's MTPerlScript and MTOnThisDay plugins. I had MTOnThisDay make the guts of a Perl array of entry IDs, from which the script would then select randomly.
The latest change--so I could put the daily item in my full RSS feed--was to not actually use a random item. Instead it hashes the date to a pseudorandom number that's even less random than normal "random" numbers in a computer. The hash is totally deterministic: mathematically it's (year * 100 + day) * 1997 % Nentries. Because it's deterministic from the date, no matter how many times you republish the page (or entries you post today, as posts from the published year are omitted) you get the same "random" entry.
I uploaded 1.1 this morning (1 February). Apparently it wasn't removing the post #1 from the array as it should've been, so my on-this-day post for 1 February was my post #1, which happened to have been 25 March. Oops.
But is now fixed, looks like.
Comments
comment
It just came up with item #1 (25 March 2001) for 1 February, so something’s wrong. Will look.
comment
OK, it seems fixed. I was reusing the main @entries array when I probably shouldn’t’ve, and stuff. I put up a 1.1.