Neil Turner's Blog

Blogging about technology and randomness since 2002

Spangly dates

Thanks to a bit of PHP and a new table in one of my SQL databases, if I post an entry on a predefined ‘special day’, then the name of the event will be appended to the date. You can see this in action above, since today is Christmas Eve.
The code is very quick and dirty, in that I knocked it up in about an hour today, but if interests you, take a look at the source code for the home page and code for the date function. If you do implement it, bear in mind that I’ve not written anything that will let you manage the database – you’ll have to add them yourself using phpMyAdmin or something. You’ll need day, month and description fields, the first two being integers and the latter being ‘varchar’, plus an ID for the primary key – set this to autoincrement. It’s not used in the script so call it what you like.
There’s probably a Movable Type plugin that’ll do this for you but you don’t get the same satisfaction of having written something yourself.

One Comment

  1. Nice idea: but why go through the bother of re-inventing the wheel. I know there is a nice satisfaction to have from “rolling your own”, but why bother when somebody else has already done the work for you?
    Actually, checking the template I see you are including the Blogrolling feed dynamically in the pages. Good idea, but it can slow down page rendering times if Blogrolling is down/slow and create a bit high processor usage if your site is popular (as the Blogrolling feed has got to be fetched anew for every single page). Any reason why you aren’t using my Cache Remote like you blogged about? 😉