Sat 20 May 2006
If you hit this site or RSS feed today at the wrong time, you may have gotten strange or broken results… this is because of some little stupid thing that I was working on today. I wanted to have my random face image that you see in the upper right show up in the RSS too because that is how many people read the site. So I got a rss feed plugin “better feeds” that allows you to customize the way the RSS feeds work, and then I hacked it up to include my random face image. After a couple of aborted attempts, I finally got it working, but for some reason some of the Wordpress administration tools completely stopped working.
Baffled, I reverted themes but found the same error present, and I struggled for a long time trying to figure out what the heck was going on. Eventually after ruling out lots of other things, I disabled the plugins and found out that the problem was caused my inclusion of the “better feeds” plugin — but I still didn’t know why that should have anything to do with the problem. So i did a bit of reseach, and I found out that the PHP include function which I was using to share code between the RSS feed and the sidebar, brings all of the variables from the included file into the current scope. That is to say, all of the variable are completely global.
So one of the variables I used in my face rotation script conflicted with a variable name that the wordpress administration system uses, so when they overlapped it would prevent the administration from working problem. When I finally moved all of the variable names to be specific to my little script, the administration interface instantly starting working again. What I find most amazing is that not only is this behaviour not considered a bug, it’s seems to be an intentional feature of the wordpress, and indeed is the foundation of how the plugin system works.
This strikes me as a very terrible solution — to rely and use globals all over the place is just asking for trouble, trouble of the sort that I accidentally ran into. I’ve seen plugin solutions implemented elsewhere and I suppose I just assumed that having hooks in important places and making that available to plugin authors was the way everyone did plugins. But I’m not really impressed by the utter lack of controls wordpress seems to implement. Oh well, it still works well as a blogging system…
In other meta news, I added a “how awesome is this post?” rating system to each entry, so please (ab)use this as you see fit.



May 20th, 2006 at 9:34pm
1) PHP sucks as a whole. It’s not really intended for large-ish apps. I’m always banging my head against its lack of namespacing and real modularity, especially when I’m trying to hack on other peoples’ code. (There’s a reason phpbb_integrate hasn’t been ported to WordPress yet.)
2) Although you wouldn’t think so, RSS doesn’t really allow relative image links, at least not in any portable way. You need to use absolute URLs for face images (and everything else, for that matter). Yes, it sucks.
3) This wine I got from Ballard Market which was imported from La Mancha (as in, birthplace of Don Quixote) is quite awesome.
4) I noticed the rating bauble thing when I was posting a comment earlier. Fairly cute. Readers who liked this entry also liked the one about cheese.
May 20th, 2006 at 9:44pm
fluffy: I already agreed with you about point 1 before, but even moreso now that I’ve seen it in action. Regarding your second point, I did not know that, it worked fine in my rss reader but regardless have fixed it so that it works better on other readers. Regarding the third point… Wine! Yet another thing I can buy with money. Job-having rules!
May 21st, 2006 at 6:35pm
If I ever needed yet another reason that you are my hero: random Ryna images with the RSS feed is it!
May 21st, 2006 at 8:01pm
joh3n: but who, I ask, is the wind beneath your wings?