Wednesday, September 12, 2007, 3:44:58 PM, blues wrote:
> i am using pmform to add comments, and i would like
> to have a way to know how many comments there are on
> the page.
commentboxplus.php defines a {$PostCount} page variable.
You could use it or a renamed version I guess.
>From commentboxplus.php:
# add page variable {$PostCount},
# counts message items per page
$FmtPV['$PostCount'] = 'StringCount($pn,">>messagehead<<")';
function StringCount($pagename,$find) {
$page = ReadPage($pagename, READPAGE_CURRENT);
$n = substr_count($page['text'], $find);
if ($n==0) return ''; #suppressing 0
return $n;
}
The function counts the occurrences of >>messagehead<<, which is
inserted in the top of every message, so gives a good indication of
the number of comments in the page. Yoic an replace >>messagehead<<
with a suitable string your form adds for every comment.
~Hans
_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users