views:

589

answers:

5

I am building a new site which will consist of a mix of dynamic and static pages.

I would like to add commenting functionality to those pages with as little work as possible. I'm curious as to whether such a solution exists in PHP.

The ideal set of features would be:

  • Completely independent from the surrounding page / site: PHP code gets dropped into page, a page ID is added, done.
  • Simple "write a comment" form
  • Comments for each page are displayed using a PHP function
  • Nice, clean output of <ul><li>.... that can be styled by the surrounding site
  • Optional Captcha
  • Optional Gravatar sensitivity
  • Minimalistic administration area to moderate/delete comments, no ACL, can protect it using .htaccess

The ideal integreation would be like this:

<?php show_comments("my_page_name"); ?>

this would 1. display a form to add a new comment that gets automatically associtated with my_page_name; and 2. display all comments that were made through this form using this ID.

Does anybody know a solution like this?

Bounty

I am setting up a bounty because while there were some good suggestions, they all point to external services. I'm really curious to see whether there isn't anything self-hosted around. If this doesn't exist yet, it sure would be great to see as an Open Source project.

A: 

Well if you are looking trying to create something light weight, and have access to a DB I would recommend creating a table structure like the following:

id, primary key, auto-increment,
page_name, text,
author, varchar(90),
email, varchar(256),

you could then write 2 short scripts that will allow a person to add entries and view them for a given page name add: It could just be

add:
mysql_insert(sql_query_here_that_contains_form_fields)

view:
mysql_fetch_assoc(query here based on page name)

The include would then be view.php?name=x ...

Personally I would use cakephp for this. I would also use jquery to fancy it up. That may all make your life easier, or much more difficult

As far as external stuff, perhaps you can search for a guestbook application that doesn't require you to create a new guest book for every page, rather it should detect if the page has been seen previously and group accordingly....

There are better ways the handle the above psuedo code; however, I was attempting to keep the number of lines down to a minimum for you.

Parris
Cheers Parris, I appreciate the effort. I know the basics are quite straightforward to set up. I am however looking for something ready-made so I don't have to develop all the bells and whistles it would take to make it really worth working with: A halfway decent interface to delete and edit comments; possibly a Akismet hookup to prevent comment Spam; A Captcha system to prevent spam; A notification system to inform on new comments; and so on. Before I start doing it myself, I would like to know whether anybody knows something that can do this out of the box.
Pekka
A: 

You code checkout this article: http://www.pcmech.com/article/external-comment-hosting-blogging/

I know Haloscan is a decent place that will hsot your comments for you.

eTiger13
+10  A: 

If you really want an easy to use solution, then just download the intensedebate or Disqus comment HTML and you can leave spam checking, OpenID support, Comment sharing, and every other cool feature to them. You get the comments with no work!

It's a win-win. Then later on you can use their API's to pull the comments and put them in your database if you want to switch to a home-made solution.

This also means that you can still get SEO from the comments because when you pull them from the API you can display them in an <noscript> tag or hidden div for the search engines.

Xeoncross
Cheers, I will take a look into this.
Pekka
A: 

Comment systems can be very database heavy and bog things down. I would checkout:

http://intensedebate.com/

You could call it the Wufoo of comments (only better). I've not used it on my own site, but know some people who do and they love it.

orokusaki
+6  A: 

This?:

http://www.gentlesource.com/comment-script/ - paid if used commercial, but...

http://cellbiol.com/scripts/free_php_guestbook/free_php_guestbook.html - flat-based, weird design of page (... :]), but has free and simple version

http://www.scripts.oldguy.us/talkback/features.php - free, they "require" small donation if you want to remove their logo

Adam Kiss
Cheers @Adam. The GentleSource one comes closest to what I'm looking for.
Pekka
Glad I helped, I was just right now shocked about my rep. bump :D
Adam Kiss
Some cool scripts here, I'm pretty sure I could find a use for them! +1
Rowan