Page 1 of 1
Feature Creep for Comments
Posted: Mon May 14, 2007 4:13 pm
by Ambush Commander
I'd like to add the ability for users to add comments to my website. Seems innocuous enough, except that my application does not currently use databases and is built on the compilation of XHTML files into static HTML files to be served to the general public. So if I implement comments, I'll probably end up having to implement a whole bunch of features that I don't actually want to implement!
Therefore, before embarking on this treacherous journey, I'd like to pin down possible feature creep:
- Database credentials / abstraction layer (ugh) or XML data layer
- User login / OpenID / Gravatar
- Comment anti-spam / moderation interface / captcha
Anything else?
Posted: Mon May 14, 2007 4:38 pm
by kyberfabrikken
I put up a blog-ish site recently, which is all static HTML files. The content come from XML-documents, and I then have a script to "bake" the site (Generate the static content; Eg. HTML and RSS). I wanted to allow comments, but I also liked the simple solution. So I created a script to post comments, which would stuff the comment in a database (SQLite), and mail me. I'd then go to a simple administration page, which shows un-approved comments, with an 'approve' and 'delete' button. After approving, I'd re-bake the site. Since I don't get thousands of comments a day, this is a really efficient way to avoid spam.
All in all, this took me a couple of hours to throw together, and it's completely bullet-proof. Some times, you don't need to pull out the big guns to make something work.
Posted: Tue May 15, 2007 2:59 am
by Maugrim_The_Reaper
Shouldn't be a huge chore. If the compilation process is capable of being run automatically, then it just needs an extra trigger (approval of comment, or approval of anonymous comment by a web service - check out Akismet which is free). If the storage is going to be small, just use an XML file, otherwise a small database. The whole thing is already file based, so your backup system should cope.
User authentication is the part that will push you towards a more complex solution. Gravatar is a tiny feature - easy to add.
Posted: Tue May 15, 2007 3:14 pm
by Ambush Commander
Glad to see this won't be too much trouble. I'm still worrying about the database abstraction layer though. A well designed one can save a lot of trouble, but they require quite a bit of initial investment to make. A mapper would be ideal, I think. (BTW, PHP 5)
Backing things up, actually, is a bit of a concern. The entire website runs out of a Subversion checkout, so code and HTML all are under version control (which is exactly the way I like it, and is the only method of backup). But I don't really see how I can "commit" comments into the SVN. Plus, I have to be careful not to publish sensitive user data like IP addresses.