As 0033 and Manette have been doing a great job keeping the site’s content up-to-date, I’ve been doing a bit of playing around with behind-the-scenes stuff. First, a little background: one thing I’ve always disliked about blogging applications is that their handling of comments tends to fragment reader discussion more than (E.g.) a forum or a newsgroup. And even when there’s a lively discussion attached to a post, it usually dies out when that post gets pushed off the frontpage by newer items – rather than when people lose interest in the discussion.
Enter my rather hacked-together solution: an “All Comments” page that displays a forum-like index of recent comments, grouped by post. There are still a few missing pieces – mainly timezone options (everything is in Atlantic Time right now, aka GMT-4) and the ability for readers to create a new thread (a la a real forum). But it’s close enough to make live at this point and add it to the navigation links on the lefthand side.
If anyone is interested in the technical details, read on.
One of the main reasons I’ve stuck with WordPress for the last few years is its flexibility – quite a lot can be accomplished by working within the WordPress template / theming system. And if you want to do something that’s not possible with WordPress’ built-in functionality, then the PHP + MySQL foundation makes it fairly easy to work around WordPress and read directly from its database.
The forum-like display of comments uses the second approach. It’s effectively just a page with some PHP code to read from the WordPress database – combined with the Exec-PHP plugin (otherwise, WordPress would prevent the PHP code from executing).
A copy of the code is available here: all-comments.txt (change “.txt” to “.php” to use it). There are a few configuration variables that will be need to be edited so that the script can connect to your WordPress database, starting at line 32. And one final note: yes, I used tables. So if you’re the sort of person who forks the sign of the evil eye whenever you see a "<table>" tag, then you really don’t want to look at the code too closely.
|Category: News - Comments RSS - Post a Comment - Trackback|
|« BeOS Vintage Hardware||Quick News Updates »|