Basicly these blog items serve as a personal reminder and documentation. Also the code needs to be refactored a bit and some html tags need to be removed from it.

Files needed

The following files are needed for this comment system:

  • comment.php, this is the PHP file the implements everything

  • nbadmin, a small shell script that implemented the comment moderation (just a mv of the comment to the correct directory)

  • nbnofity, small shell script that notifies you a new comments (to be put in cron)

  • com.css, the css code for the comment pages.

Templates

In your templates you will need to require the php script, so a

require_once "/home/miekg/miek.nl/comment.php";

must be there somewhere.

Further more all pages that do something with comments need the following code:

  • Get the current comments and put them in a PHP array

$comments = gather("$NB_EntryID");

  • Show the current comments as HTML

show($comments);

  • Check the current form input and act accordingly

if ($_POST['preview'] == "Preview Comment") {
	    preview();
}
if ($_POST['submit'] == "Submit Comment") {
	    submit();
}

  • Show the comment input form

form("$NB_EntryID");

  • Show a “recent comment” section in your side title

recent_comments();

And that should be it.