While working on an earlier post, I needed to find a way to display a PHP module on a web page without having it executed. I knew this was fairly simple and involved the .phps file extension, but I hadn’t done it before. A quick search of the PHP site pointed me to the highlight_file function. About halfway down the page there is a blurb about the MIME type that I needed. It turns out that my web hosting service already has this enabled, so all I needed to do was get a .phps extension on my file. I did it the easy way, with a softlink:
ln -s myfile.php myfile.phps
For those who don’t know Unix, this effectively creates another name for the same file, which is exactly what I want. This leaves the original .php alone, so that it can be run by the web server. But is also allows me to post the code on the web, using the .phps “file” which the web server will display instead of executing. The elegance of this solution is that if/when I modify the original code, I won’t have to make any changes to the displayable code because there is really only one file (with two distinct names).
A few days ago, Joseph and I were talking about bolting statcounter onto our blogs. He’s the one that pointed out statcounter to me, and all he needed to do was add the statcounter script to his theme’s footer.php file. This would probably work for any single-theme site, but I’m still running multiple themes on my blog. I need to do one of the following if I want to use statcounter:
- Drop all but one theme. There are several good reasons for this, most important of which is maintenance. This would allow me to add the statcounter script to the remaining theme’s footer.php and I’d be done.
- Add statcounter to all my themes. This probably wouldn’t be too bad, except for maintenance–whenever a new version of one of my themes came out, I’d have to manually reapply my changes.
- Write a plugin to insert the statcounter script in the footer of every page. This would be the most work up front, but it would give me a good excuse to learn how to write plugins for WordPress.
I found some useful resources for plugin authoring. The WordPress codex has a section on writing plugins. Owen’s tutorial is a great introduction–just read it and start hacking!
Carthik’s Plunge into Plugins article has lots of good advice, but isn’t a tutorial–check it out after/while you get started with Owen’s page. More good info is available on the Codex page Writing a Plugin.
I’ve started working on this plugin, and I’ve already been bitten by the “extra blank line” problem. (Admin interface was reporting “Cannot modify header information - headers already sent by…” error. Note to self–scroll to the bottom of each PHP file, and make sure the PHP close tag is right at the bottom of the file.) I have the code to insert arbitrary text into the footer, but I still need to add the Options menu which would allow J. Random User to edit the text to be inserted. (Right now, the text is hard-coded in the “plugin”, which I have installed and activated on this blog. Check the bottom left corner of any blog page for the statcounter.)
I don’t see any reason for this plugin to be statcounter-specific. It would be more useful to provide some sort of generic footer plugin which would allow HTML or javascript to be inserted in the footer. We’ll see how it goes. If I’m happy with it by the end of the night or later this week, I will go ahead and release it.
Spam Karma 2 rocks! Have I said that already? Well, not in so few words…
But I just noticed something. I wrote a post last night with multiple references to my own blog–in this case, I refered to two other posts. The first reference correctly generated a pingback, but the second reference doesn’t seem to have been handled. SK2 didn’t log it as spam or a valid comment, and there is no pingback comment in the second post that I linked to. I’m going to disable SK2 for a minute while I post this article, to see if both pingbacks are done correctly, then I’ll contact dr Dave and let him know what I’ve found.
When I originally set up my blog, I installed Farook’s WPBlacklist plugin to help combat blog spam. Then, a few days ago I installed Spam Karma 2 in order to take care of issues that were possibly being caused/exacerbated by WP-Gatekeeper. Today while perusing the management interface for SK2, I discovered that it handles blacklisting as well. I chose to let SK2 handle blacklisting and disabled WPBlacklist because:
- I want to use SK2 as my primary spam filter, and
- SK2 doesn’t require manual BL updating, as WPBlacklist does.
SK2 can even update the RBL when spammed.
This is turning out to be a pretty spiffy plugin! I get grim satisfaction from looking over the “recent spam harvest” and seeing the blocked attempts.
siriradha is sending a box of books to the Modoc Hall/Java City OBCZ. Thanks, siriradha! These are being sent fourth class (media mail) from Colorado on Wednesday, 2005-08-31, so they might show up almost any time in September. (Media mail is handled whenever the post office feels like getting around to it, seem like.) As soon as they arrive, they will be journaled on the OBCZ bookshelf.
It was too hot to cook again on Friday night, so we went looking for a good Chinese restaurant in our new neighborhood. I think we may have found it–Eastern Empire on Howe near Fair Oaks Blvd. My wife and I ate lunch there a few days ago, and we thought the kids would like the food. It turns out that we were correct.
The sweet & sour pork, foil-wrapped chicken and pork chow mein were all big hits with the kids. My older daughter also liked the chicken with garlic sauce. My wife and I liked the lemon grass beef, but it’s not as good as that available at BoBo’s.

I found The Green Mile on the bookshelf at work a few days ago, just finished reading it late last night. I’ve never considered myself a Stephan King fan before because I always perceived him as a horror writer, a genre which doesn’t interest me in the slightest. But after reading this book, I started thinking about some of his other stories that I’ve read–Rita Hayworth and the Shawshank Redemption (from Different Seasons), The Running Man (under the Richard Bachman psuedonym), and The Shining. Of these, only ‘The Shining’ really has much of a “horror” feel to it. I think I may have to pay a little more attention to this author, even if he is extremely popular–I hate following a fad, but in this case there may be a reason (other than marketing) for his wild popularity.
Books I’m going to look for by this author include The Dead Zone and The Stand, both of which are available from the Sacramento Public Library.
I’ve seen the movies based on all these books, except for ‘The Green Mile’. I read ‘Shawshank Redemption’ and ‘Running Man’ after seeing the movies, and liked both the movies and the books. I saw ‘The Shining’ after reading it, and was disappointed with the movie. This is almost always the case with me, regardless of author–as long as I haven’t read the books upon which they’re based, the movies stand well on their own, while the books add depth to the story once I get to read them. Because of this, I probably won’t see the movie rendition of ‘Green Mile’.
I read a post today on Nicholas’ blog which indicated that he was having trouble commenting on my site. I’ve had other commenting problems (1, 2) in the past which have been traced to my spam-blocker, WP-Gatekeeper. I haven’t spent any effort on the current problem, I’m just assuming that gatekeeper is at fault, so I disabled this plugin and installed Spam Karma 2 since Nicholas seems to be getting good results with it. I’m not sure what Joseph is using nowadays, but gatekeeper may be doing the trick for him–I found out a few days ago that he hand-rolled his crisp minimalist theme, and perhaps gatekeeper plays well with such a setup.
I’ll run with Spam Karma 2 for a while and see how it goes. I hate to think that people might have tried to post comments here, failed, and given up on this blog. I really have no idea how many people read the crap I post, but I know there are at least a few people out there with too much time on their hands.
When I published my review of “Free” by Mike Comfort, I sent him an email letting him know about it. Imagine my surprise when a published artist took the time to write back, almost immediately! I can certainly accept a very small delay in shipping the CD, especially considering such a personal response.
The best thing in the email was the news that Mike is planning to release a new CD next month. The release is scheduled for September 23, to coincide with a show at La Salles in Chico, Calif. There’s a bit of information on La Salles’ calendar app, but I can’t seem to link directly to the show, or even to September–you’ll have to browse the calendar, select “September” on the pull-down list, then click the show link for “Thirst” on September 23rd.
More good news is that Mike is working on getting his CD into stores. I’m happy to support an artist directly–the prices are cheaper because there aren’t any bloodsuckers middlepeople between me and the artist, (except the postal service), hence the artist gets more of the money. However, there are two major problems with direct sales:
- The artist has to spend time doing non-artistic things like producing the CD’s and filling orders. All the time spent on this comes at the expense of the art.
- Nobody can jet down to the record store and pick up the CD right now. For some people, this may be a deciding factor. Other people may not trust PayPal, or whatever online payment system is employed, and avoid ordering via the web.
I think having the CD in stores would help promote the artist. I won’t be happy with the increased price, but you can’t have it all.
I stopped by Viking Hobby today and got to chatting with Mark about the top-rated games on the ‘Geek. Until today, I only knew how to find the rank of a particular game, and there’s no Internet access in the store, so I told him that I would check out the ‘Geek after work and see if I could find such a list. It turned out to be pretty easy. To save other folks the trouble, I’ve included a link to the highest-rated games on BoardGameGeek. I’ve printed out the first page (the top 29 games) of this list, so that Mark and Jess can keep it at the store for reference.
I guess it’s sort of predictable that I own the first- and second-ranked games, and the third-ranked game is high on my wish-list.