|
Cookbook /
CommentBoxSummary: Adds a simple form to post comments
Version: 2.0.19 (released 2007-10-31)
Status: Stable
Prerequisites: pmwiki 2.0 and above; 2.1 recommended
Maintainer: jr
Discussion: CommentBox-Talk
GoalGive authors a simple way to add a comment box to a wiki page. Solution
See also
Update: commentbox.phpΔ and commentboxplus.phpΔ are no longer allowing edit access to pages if no edit permission is present (a former security risk). - Jan 30, 2006. Note: this uses the run-in head markup to lay out comments, so requires the MarkupExtensions to work correctly. However, the variables can also be redefined to work with a standard PmWiki install.
InstallationPut commentbox.php into the cookbook/ directory. Add the following to local/config.php include_once("cookbook/commentbox.php");
UsageFollowing the (:searchbox:) directive naming convention, there are 2 new directives: (:commentbox:)
!!!!12 July 2005
!21:39 by '''[[~Pm]]'''!post again
!21:39 by '''[[~Pm]]'''!Test comment
posts comments latest first
(:commentboxchrono:) posts comments latest last
You can put (:commentbox:) in a GroupHeader -- all comments get posted at the top of the page. You can put (:commentboxchrono:) in a GroupFooter -- all comments get posted at the bottom of the page. If the page name ends in Journal or Diary (configurable), the script automatically inserts a comment box after the GroupHeader and before the text. You don't have to state e.g. (:commentbox:) anywhere for this feature (except loading in local/config.php of course) Posting comments to other pagesThis is a new feature. The recipe also supports posting comments to different pages with the (:commentbox pagename:) option. As this is potentially a security risk, there are a number of controls in place using global variables that an administrator sets in local/config.php:
Format of commentsAn administrator can control the format of comment entries using the following variables. See also samples in source.
The $Date, $Time and $Author strings get str_replaced with the current values within the script. Note the $ for variables defined using " ... ". Administrators will want to test their use of "n" carefully -- the script author kept having too many or too few, leading to unexpected (and unwanted) results.
Journal
SDV($JPDateFmt,'!!!!$Date');
SDV($JPTimeFmt,"\n\n>>journal<<\n!\$Time!");
SDV($JPItemEndFmt,"\n>><<");
Diary
SDV($DPDateFmt,">>diary<<\n!$Date!");
SDV($DPItemFmt,"\n\n: :");
SDV($DPItemEndFmt,"\n>><<");
Message
The default styling is h4.journalhead, h4.messagehead { background:#ffb; border-top:1px dotted #999; }
.message, .journal, .diary {
padding:3px;
border:1px dotted #999;
background:#ffc;
}
History
ContributorsCommentsSee discussion at CommentBox-Talk User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki. |