I had previously used PHP to handle switching between the different CSS stylesheets on the site. This was quick and easy for me to implement, and didn’t rely on anything from the client side except for cookie access.
However, it had one major downside: it broke under caching. Basically, each page has a tiny embedded script that writes out the code reference to the proper CSS stylesheet based on the style cookie’s value. There are links for switching the stylesheet; they take you to an external script that simply changes the value of the style cookie. That script would then send you back to the referring page (header("Location: $HTTP_REFERER");). The original page would then load, and the new cookie value would be parsed by the embedded script, writing out the code reference to the new stylesheet choice. Right?
Not if the original page was cached by the browser.
This lead to an annoying situation in which you would click on a different stylesheet choice and nothing would change at all, at least until you visited another page that hadn’t been cached yet. To get around this, I temporarily slung in a bunch of PHP that told the browser not to cache the pages at all (it’s one of the examples on this page.) Of course, this meant that every page had to be evaluated by the PHP engine on my site’s server every time you loaded it into a browser, even if absolutely nothing had changed.
So, I actually did my homework for once, and found a solution that did everything I wanted in terms of switching stylesheets, without requiring me to disable browser caches on every page. I stole the code from an article on ALA, and I only had to tweak it a tiny bit to allow for different style cookies attached to different parts of the site (there are separate style choices for each of the interior pages, /holly, /jack, and /daphne).
This solution requires Javascript on the client side, but hey, you can’t have everything. Anybody with a browser new enough to handle my stylesheets has appropriate Javascript support anyhow, and hardly anybody bothers to turn it off. As an added bonus, it actually switches styles a little bit faster than my old solution. Yay progress!
Comments
I’ve finally moved Holly’s and Daphne’s pages to Movable Type. This makes me feel a little better - the structure is a little more well-founded, it’ll be easier to redesign or alter things in the future, etc.
Unfortunately, it does not mean that the pages are all pretty to look at. I wish I had even a little bit of design sense - when I visit pages with good design, and then come back here, everything looks drab and uninteresting. The thing is, getting to look even this good was hard for me.
Holly has helped to push me toward better-looking pages - and indeed, her page and Daphne’s are much improved at this point - but Holly knows even less of (x)html/CSS than I; there’s only so much she can do.
::sigh::
Comments
So, Bush backhandedly admits that Saddam had no ties to 9/11.
Well, duh. Anybody paying attention knows that. (”But Jack, why do more than two-thirds of Americans think that Saddam had something to do with the attacks?” Because they aren’t paying attention.) The only remaining justification for the war is that Saddam was, you know, no longer meeting our criteria as an acceptable murderous dictator (”Duh, Pinochet and Rios Montt am good, Saddam am bad, Koko like banana, yum-yum”).
My question is, why do any of these people still have jobs? I’m talking about Bush, of course, but I’m more specifically wondering about Rumsfeld, Rice, Powell, and other senior officials in the Bush administration.
What’s that old saw about bureaucracy… “if I ran my business like the government, I’d be out of business,” right? Well, if I behaved like these cabinet officials, I’d not only be fired, but also sued by my former employers and possibly jailed for fraud.
I mean… turning a huge surplus into a record-breaking deficit, going shockingly over budget on the war, steadily losing troops to enemy fire long after combat has been declared over, mis-predicting the timetable for rebuilding and the likelihood of winning the battle for ‘hearts and minds’, finding no weapons of mass destruction or other evidence that Saddam was violating the U.N. resolutions, handing hugely profitable no-bid sweetheart contracts to companies with preexisting relationships to key administration officials, constantly being proven wrong on assertions about yellowcake, aluminum tubes, and meetings in Prague, failing to find the actual bad guys (Saddam and Osama), undersupporting Afghanistan until the Taliban and al-Qaeda have time to regroup and consolidate power, giving our allies the finger for months before turning around and asking them for cash and soldiers… I could go on like this for days, if only I had the energy.
Can these bozos do anything right? Other than ramming their politically motivated tax-cut packages through the legislative process over the objections of responsible economists, and campaign fundraising? What do you have to do to get fired from this administration? Directly profit from the death of American soldiers? Be seen eating Brie? Lie about an affair?
Comments
As I was hanging out with Daphne this afternoon, she decided to indicate that she was hungry by grunting. Normally she gets a little whiny, gums at my shoulder, and drools excessively when she wants food.
This time, she grunted. Loudly.
It took me a while to figure out that she was trying to tell me something. She’s at a stage where she keeps discovering new ways to make noise, and exercising those sounds aggressively, so she could just as well have been grunting to hear herself grunt.
After she’d nearly grunted herself hoarse - a guttural, throat-rattling abdominal crunch of a sound, as if she were trying to dislodge a Monopoly piece from her esophagus - I finally got the clue that she was hungry. As I was giving her the bottle, she looked at me like she thought I was denser than lead.
My question is, how am I supposed to keep track? I’ve heard parents talk about their kids speaking a different language, but geez, I understood her just fine until she completely changed the language of discourse, with no warning!
On a mostly unrelated note, she’s started sucking on her fingers only from the side. This helps her avoid slicing her fingers open on those two razor-sharp tooth-nubbins, but it has the unseemly side effect of pulling her lips back into a skeletal grin, and furthermore, allowing gallons of drool to drain out.
Icky!
Comments
So, I went and switched my section of the site (everything under /jack/) to Movable Type, as I threatened to do in a previous post. If I’ve done everything right, you will barely be able to tell anything is different.
Ok, I guess there are a few differences. Entries now go to individual archives, with the comments at the end of the page, so there aren’t any comment popups. There are ‘back’ and ‘next’ links at the bottom of each page that should be context sensitive… e.g., if you’re looking at a daily archive page, they should take you to the next or previous day’s archive; likewise for individual and monthly archives. Yearly archives are broken for the moment, but don’t expect that to last.
I expect I’ll eventually get around to doing things like category archives, rss feeds, and so on. And, of course, I’ll need to do the same shuffle with Holly’s and Daphne’s pages. Woo-hoo!
Comments
If you want my opinion, you can’t do better than this:
When I was just a young man
my momma told me “son
always be a good boy
don’t ever play with guns”
but I shot a man in Reno
just to watch him die.
when I hear that whistle blowin’
I hang my head and cry
Bye bye, man in black.
Comments
Predictably enough, after spending a bunch of time customizing the blog layout, site organization, etc., I’ve decided that I hate the whole thing and want to start over. Thankfully, I only got around to changing my page and Holly’s page.
So, at some point, I’m going to move to individual-entry based archives with embedded comments (no comment popup window) with slightly more semantically-oriented URIs, along with the full complement of date-based archives in place now. To facilitate this, I’ll probably switch the back-end blog engine from b2/CafeLog to Movable Type.
I’m not entirely happy with that idea, frankly… MT generates static pages, as in actual files on disk. I build database-driven web apps at work, so generating static files over and over, and having to regenerate them if you change something, seems foreign and incomprehensible to me. I suppose I could look at it as being isomorphic to a file-based output caching system like that in PEAR, but it really isn’t. The decision to move to MT is motivated by the great community support for MT - for example, there are plenty of quite nice non-web interfaces for creating and editing MT entries.
I’ll have to console myself by working at concealing how the site works. It bothers me that people might look at my site and think, “ah, he’s using Movable Type.” I don’t know why that’s so, but it is. If you’re looking at my section of the site (or Holly’s), it is hopefully not readily obvious that I’m using b2 or, indeed, PHP. I expect I’ll continue that effort by eschewing file extensions (no .php for me) and maybe by hiding MT’s comments.cgi and search.cgi, and so on. I’ll still give attribution, of course - I’m not a total jerk - but hopefully it’ll be enough to keep my poor little blog from looking exactly like everyone else’s. I particularly like rentzsch.com for the non-standard feel (and lovely semantic URIs)… and, indeed, it seems he rolled his own blogging software, in WebObjects, no less!
1 Comment