[pmwiki-users] Variations on Commentbox and its variants
john.rankin at affinity.co.nz
Wed Sep 20 19:10:43 CDT 2006
On Thursday, 21 September 2006 3:34 AM, Michael Gleicher <gleicher at cs.wisc.edu> wrote:
>I would like to have pages that allow for quick entry of new
>information. The Commentbox recipe (and CommentBoxStyled and CommentBox
>Plus) almost get me what I want. Unfortunately, my PHP skills aren't
>quite up to the point where I can hack it, so I could use a
>Some of the simple things I'd like to do:
>1) have a (:commentbox:) that has the same behavior as having the page
>named "Diary" (e.g. the way the formatted results look with only the
- the value 'Diary' is a variable; suppose you wanted all pages ending
in 'Comment' to behave like Diary pages, you would add the following
line to local/config.php, above the line that includes commentbox.php
$DiaryPattern = '/Comment$/';
this will automatically load the (:diarybox:) directive on those pages
>2) have a (:commentbox:) that just creates a list item (so the entire
>formatting is "* comment text\n"
- this *may* be simplest to do with a new form, as the current
commentbox code assumes there is always a date in the posting
try the following in local/config.php and use (:commentbox:) markup
in the page
$MultipleItemsPerDay = false;
$MPDateTimeFmt = "\n* ";
$MPItemEndFmt = "\n";
you will also want to copy the code that defines $CommentBoxFmt
into local/config.php, remove the lines that prompt for the
author and use input type='text' instead of a textarea for the
comment (put this above the call that includes commentbox.php)
>3) have a (:commentbox:) that asks for a 1-line title in addition to the
>text itself, and creates postings that are blog-like.
- this is on my to-do list, but there are other recipes more suitable
for blog-like postings, so I have given it a low priority
>I think that 1 and 2 simply involve changing the values of various
>strings, but I'm neither sure of how to set the values nor how to do
>this on a per-page basis. (different pages on the same Wiki do different
>I am thinking that this (definitely #3, but maybe just having a
>parameterized comment box to do #1 and #2) will involve at least some
>hacking of the commentboxplus recipe.
The commentbox code should really be rewritten to take advantage
of features available in pmwiki that didn't exist when it was first
created. As I understand it, such a capability is coming "soonish" to
pmwiki itself, so again I havew given it a low priority.
>I'd appreciate any advice on how to do this. Even more basic things
>like how do I learn the basics of hacking inside of PMWiki (like, what
>does "SDV" do? - and where is it documented).
SDV is incredibly useful. It says "if this variable already has a
value, use it; otherwise, use this value". It allows recipe authors
to set default values, then individual administrators can over-ride
these with local values, without having to change the recipe.
>Sorry if this is a newbie question, my PHP skills aren't quite up to
>understanding the code to the cookbook entries
Well the code that posts commentbox entries is handling a lot of
different cases, and has slowly accreted complexity as more cases
were added. If it were a ship, it would need to go into a dry
dock for a refit.
More information about the pmwiki-users