This is not a page to leave comments to all cookbooks!! It is the page for the recipe "Comments"!
This recipe may be obsolete: It uses the deprecated mailposts script, and the maintainer has not been available for assistance. It also had some serious drawbacks, even when it was current. You may do better to look at other recipes in the Comments category.
This is a backup from Google Cache 2007-02-10, because the history of this version of the page wasn't available.
This module enables comment functionality on all pages in the wiki. It doesn't mess page content, because comments are stored in separate files. Users have ability to alter their comments right after posting. Wiki markup is supported. Installation
To install the software, unpack the zip file and copy its contents to your pmwiki directory.
Add the following line into your local/config.php file:
Then, to display comments you should call PmWiki with action=comments. For example you may add the following line in your pmwiki.tmpl template file, if you're using standard template:
<a href='$PageUrl?action=comments#comments'> $[Comment] (<!--function:DisplayCommentsCount -->) </a>
If you want comments always to be displayed in pages, Add the following line into your local/config.php file after including comments.php:
To be able to remove comments you also need to set the default password for this action:
See also Passwords and PasswordsAdmin for information on using passwords in PmWiki. Usage
To display comments call pmwiki.php script with action=comments. Or simply open any page, if the comments are shown by default. Under the page text there will be a bunch of already written comments (if any) and the form to enter new comment. It looks like:
Enter your comment: [ ] [ ] [ ] [ ] [ ] [ ] Author: [ ] [Submit]
After entering comment text and author name (if not entered, it's substituted by author's ip address) and submitting the form buttons are replaced by those:
Author: [ ] [Update] [Delete] [Reset]
User can now edit his recently posted comment and submit changes by pressing Update button. If the text is completely deleted and posted, the recent comment is deleted. The same effect can be reached by pressing Delete. To add a completely new comment, Reset button should be pressed to clear all the hidden fields.
The behaviour seems a bit hard to understand, but it's useful and easy when one's got used to it. As for beginners, they could probably need some advice, and it should be written in the PmWiki.CommentsFooter page. For example, it may contain the following text:
The meaning of buttons:
* Submit — submits a new comment; * Update — updates recently submitted comment's text; * Delete — removes last comment; * Reset — clears text and hidden fields allowing to enter a new comment.
The one useful feature is that wiki markup is supported in the comment text. Configuration
In the script there are two functions that set default values for the styling variables. The first one, InitComments(), uses plain wiki markup to style comments. If you are not afraid of using CSS markup, you may leave a call to InitCommentsStyled() uncommented.
Defines comment list header.
Defines text that is displayed when there's no comments for the page. By default it looks like $CommentStartFmt, but saying 'No comments'.
Defines how the comment is displayed. Has following variables that are substituted: $Author — author's name or ip; $Time — date and time of the comment (formatted with
Contains the comment edit form excepting buttons. Before changing this variable you must learn how it works by examining the default value.
Contains Submit button, which sends the new comment data.
Contains Update, Delete and Reset buttons used to alter posted comment.
By default displays PmWiki.CommentsFooter page under the edit form. Is referred in the $CommentEditFmt.
$RecentComments vList pages where notifications about recently added comments are stored, just as $RecentChanges array. By default contains Main.AllRecentComments and $Group.RecentComments. $CommentsFileName
The name of the function which takes page name as parameter and return the file name where page comments are stored. Default function returns "
Several strings in default values are made i18nable, and some of those strings interfere with the standard ones. I think this is not critical because the meaning is the same. The strings are:
* Comments (in $CommentStartFmt) * No comments (in $NoCommentsFmt) * Enter your comment * Author * Submit * Update * Delete * Reset * Set new comment removing password:
Comments are stored in
Each comment occupies exactly one line in the file. The line has the following format:
The meaning of fields is:
Apr 14, 2005
Dec 8, 2004
Oct 29, 2004
Sep 29, 2004
I decided to modify Ilya's original script so that I could receive e-mail notifications about comments through the MailPosts script. To use this, simply replace
in config.php with
Aside from integrating with MailPosts, the only other change I made was to prettify the links placed in the RecentComments pages, so that they show the name of the page, rather than the naked hyperlink. I still can't figure out how to place them in reverse chronological order; even though Ilya's code is identical to that used to create the RecentChanges pages, the order is reversed. Weird... - David A Spitzley
I'm Ilya Zverev, you can mail to zverik at int.spb.ru if you are experiencing problems with this script. I'm also subscribed to Pmwiki-users list: use it if you think that the question (and the answer) may be interesting to others.
Script was updated for PmWiki 2.0.beta6 by Jeffrey Barke (email@example.com).
See discussion at Comments-Talk