<?php
/* Tiki-Wiki Comments plugin 
 * Description:
 * This plugin shows the number of comments a wiki page or article have, so you can 
 * put after the page link the number of comments it have.
 * 
 * Syntax :
 * {COMMENTS(pagetype=>Typeofpage , page=>NameofPage)}{COMMENTS}
 *
 * TypeOfPage is one of :
 * 	"wiki page" (without quotes)
 * 	"article" (without quotes)
 * NameOfPage is the Name of the page.
 *
 * Example :
 * {COMMENTS(page=>Wickle Projects and Docs , pagetype=>wiki page)}{COMMENTS}
 *
 * @author Victor Farina
 * @version $Revision: 1.1 $Revision: 1.2 $
 * Name: $Name:  $
 * last commit: $Date: 2005/07/19 15:53:14 $ 
 */
function wikiplugin_comments_help() {
	return tra("Example").":<br />~np~{COMMENTS(page=> pagetype=>)}".tra("text")."{COMMENTS}~/np~";
}
function wikiplugin_comments($data, $params) {
	global $tikilib;
	global $dbTiki;
        include_once("lib/commentslib.php");
        $commentslib = new Comments($dbTiki);


	extract ($params,EXTR_SKIP);

	
	if (!isset($page)) {
		return ("<b>missing pagina parameter for plugin</b><br/>");
	}
	
	if (!isset($pagetype)) {
		return ("<b>missing pagetype parameter for plugin</b><br/>");
	}
	
	$datos = $commentslib->count_comments("$pagetype:$page");
	$ret = "$datos Comments";
	return $ret;
}

?>
