'; if ($article_id) { diary_BannerSection($ForumName . ' - ' . comment_LinkToArticle($article_id, $DB)); } else { diary_BannerSection($ForumName); } echo ''; } function comment_ShowArticleCommentCount($commentTableName, $Forum_ID, $ArticleID, $db) { # # show how many comments there are on this article # # # note that this function $sql = "select count(*) as count from $commentTableName"."_xref where article_id = $ArticleID"; # echo "comment_ShowArticleCommentCount sql = $sql"; $result = mysql_query($sql, $db) or die("comment count query failed: " . mysql_error()); $myrow = mysql_fetch_array($result); echo 'This article has '; switch ($myrow["count"]) { case 0: echo 'no comments.'; break; case 1: echo 'one comment.'; break; default: echo $myrow["count"] . ' comments'; } if ($myrow["count"] > 0) { # when was the last comment? # # to be written... } echo " [ read"; echo " | write ]"; echo ''; } function comment_LinkToArticle($ArticleID) { GLOBAL $q; GLOBAL $DB; # # you may have to customize this function # # create the URL needed to link back to the article. Include the article # name in the link. # This function will mostly likely require customization for each website # as the article filename and title fetch method will be unique. # $sql = "select filename, name from articles where id = $ArticleID"; $q->query($DB, $sql); $myrow = $q->getrow(); $link = '' . $myrow["name"] . ''; return $link; } ?>