|
Cookbook /
FoxCommentBoxSummary: Adding a comment form using Fox
Version: 2006-04-03a
Prerequisites: pmwiki 2.2.0
Status:
Maintainer: HansB
Questions answered by this recipeHow can I add a comment form to a page, so users can add comments (even though they may not be logged on)? DescriptionYou can add a comment form (commentbox) using Fox. Comments can be placed on the same page or a different target page, and appended or prepended relative to the form or a different location. appended comments appear in chronological order (last below previous), prepended comments in reverse chronological order (last on top). The following is an example for a commentbox markup. The comment box uses a template page, with its markup shown later. Site.FoxCommentBox
(:fox cbox put=aboveform template=Site.FoxCommentTemplate:)
|| Heading:||(:input text heading size=60:)
|| ||'''Your Message''' ||
|| ||(:input textarea comment cols=60 rows=6:) ||
|| Author:||(:input text author value='{$Author}' :) (:input submit post Enter:) ||
(:foxend cbox:)
If you need Captcha or AccessCode enabled (for wikis which allow any visitor to post a comment), set Site.FoxCommentBox with Captcha or Access Code
(:fox cbox put=aboveform template=Site.FoxCommentTemplate:)
(:input hidden accesscode {$AccessCode}:)
|| Heading:||(:input text heading size=60:)
|| ||'''Your Message''' ||
|| ||(:input textarea comment cols=60 rows=6:) ||
(:if enabled EnableAccessCode:)
|| ||Enter value {$AccessCode} (:input text access size=3 class=inputtext:)
(:input hidden accesscode {$AccessCode}:) <- Have you entered the code number?||
(:if enabled EnablePostCaptchaRequired:)
|| ||Enter value {$Captcha} (:input captcha class=inputtext:) <- Have you entered the code number?||
(:if:)
|| Author:||(:input text author value='{$Author}' :) (:input submit post Enter:) ||
(:foxend cbox:)
Both examples can be varied in many ways, both in layout and in function.
To post to a different page use as first line in the fox form markup above:
To post to a PageName-Comments page, use:
Include the comments on PageName-Comments in the current page, and the CommentForm with:
Site.FoxCommentTemplate
#foxbegin#
(:div1 class=messagehead:)
>>rfloat<<
[-{$$(date d.m.Y - H:i)}-] (:if auth edit:){[foxdelrange]}(:if:)
>><<
!!!!!{$$author}
(:div1end:)
>>messageitem<<
'''{$$heading}'''
>>messageitem<<
{$$comment}
>><<
#foxend#
This template gives a formatting to each comment post. It also adds a post delete button, for 'edit' authorised users. In any case these are just simple examples, lots of different comment forms can be built. For general use put the FoxCommentBox and FoxCommentTemplate into the Site group (or change the template= parameter to suit your location). Then you can add a commentbox in any page with (:include Site.FoxCommentBox:)
Posting permissionsBy default Fox allows posting by any user who got edit permission to the (target) page. If you need users to post to a read-protected (private) page, you need to set NotesRelease Notes
CommentsSee AlsoContributors |