A Few Words

“Welcome!” he [Albus Dumbledore] said. “Welcome to a new year at Hogwarts! Before we begin our banquet, I would like to say a few words. And here they are: Nitwit! Blubber! Oddment! Tweak!

“Thank you!”

This is a great book!

Harry Potter and the Sorcerer’s Stone cover

It’s a Sad Day In the Neighborhood

I read with great sadness this morning about the passing away of Mr. Rogers. I know a lot of people mock him and think his show is goofy, but I loved it and grew up watching him every day. I remember looking forward to his show and especially trips to the Land of Make-Believe. King Friday XIII was always my favorite. And Trolley, too. He has had a positive impact on millions of children for decades and his presence will be missed by many.

There’s a page here at the Mr. Rogers site with tips on how to help children deal with the news. I just read it and I think it is very good advice. Mr. Rogers has things to teach children yet! And I think he’d be happy about that.

User-Agent Based Content Inclusion Plugin

I’ve just released a new Blosxom plugin called UAInclude that allows you to include specific content in the section of a page, based on the User-Agent of the user’s browser. This came about because when I added Todd’s nice Categories plugin. My pages looked great with Moz or other sane browsers, but they looked like crap with IE. The reason for the difference is that IE and Moz render various styles differently, and my painstaking design was suffering because of it. Todd offered a solution, but while it made the pages look better under IE, they didn’t look as good under Moz.

Thus, I wrote this plugin. It’s driven by a hash of regexes that map to (possibly non-existent) files relative to $blosxom::datadir. Each of these regexes are compared against the User-Agent from the current user’s browser to decide which content to include. A variable called $uainclude::included_content is exposed and should be added inside the section in your head.html flavour file. This variable will contain the text of the matching file, or will be empty if the matching file doesn’t exist. (An example of when this would be useful is for a browser like Lynx which is a text-only browser; it will ignore styles, so why send them?) If nothing matches, there’s a default that will be served up, to account for all the browsers that I don’t know about.

This may not be useful to anyone but me, but I wanted to make it available. Get it here and let me know if it’s useful to you or you have suggestions for improvements.

UAInclude could certainly be generalized to support more than just head-related stuff, but I didn’t feel like thinking about it that much. If there are requests for that, I’ll think about it some more.