Geeky Sunday Afternoon Tinkering

Tinkering project #1 – Get the dates of posts and comments to display with an ordinal suffix for the day of the month.

I wanted to display the dates of posts and comments using numbers for the day of the month like 1st, 2nd, 3rd, 4th. It wasn’t too tricky, but required a bit of tinkering.

Now, I’ve got a convoluted setup for this blog, but essentially it uses Movable Type for the admin and back-end, and the pages are displayed using Smarty, a PHP template engine. Smarty has a date formatting modifier that works just fine (a wrapper PHP’s strftime function), but unfortunately strftime doesn’t support ordinal suffixes, whereas PHP’s date function does.

So, I made a Smarty plugin that acts as a wrapper to the date function, you can get it here: modifier.php_date_format.php.txt. The template syntax is {$variable|php_date_format:’jS F‘} (replace the jS F bit with any of the format characters used by PHP’s date function).

Tinkering project #2 – Put a GUI on my CD Wallet Label Generator.

I’ve recently been using CDFinder to catalog the backups and archives I’ve got on CD-ROM and DVD. I work making websites and CD-ROMs so over the years I’ve amassed quite a collection!

I’ve been giving each cataloged CD an index number (as a CDFinder comment), then filing the CD under that index number. I couldn’t find a suitable utility for printing lots of sequential index labels, so I knocked one together using PHP. (Yes, it did occur to me that I could just write them with a pen or pencil, but I wanted something neater and tidier – and more “formal”.)

Introducing Tim’s Simple CD (or DVD) Sleeve Index Generator. I use it for printing onto plain white paper CD wallets. It’s pretty much tailored for my individual needs, but it’s slightly configurable, so maybe someone else will find it useful too!

Comments