Script: 'On this day' entries (PHP)

The phrase "Wouldn't it be nice if…" gets me in a lot of trouble.

This time, it came in the context of this question: "Wouldn't it be nice if there was an automatic way to generate a list of posts that were written on a certain date? Say you've got an entry from April 24…it would be neat if, at the bottom, there was a list of all posts written on that date in any year since you started keeping a journal?"When I started writing the quasi-categories script a few days ago, I looked at it and realized that with some minor modifications, it could be the answer to that little question.

I anticipate writing a more detailed version of this script, which will actually pull the first paragraph of each post out and append it as well, but that'll take me a bit longer to write and test, and I thought I might as well get this more basic script out while I was on a roll.

The script, plus directions, is available in this year-ago.zip. You'll have to modify it to get the output to match your site, but such is life when it comes to PHP. While written for my usage, it's quite possible that other people will find it useful as well.

This code brought to you by hot cocoa, many scritchies to Edmund and Tenzing, and a couple of Sasha albums (thanks, Brad!).

all tags: