function write_comment_replies($comment, $showcomments, $orderby = "posttime", $descending = false) { $commentid = $comment['id']; echo "<!-- Begin comment {$commentid} replies -->"; $children = get_children_of_comment($commentid, $orderby, $descending); if (mysql_num_rows($children) > 0) { echo "<li>\n"; if (array_key_exists($commentid, $showcomments) and $showcomments[$commentid]) { echo "<ol class=\"child\" id=\"comment" . $commentid . "replies\" style=\"display: block;\">\n"; } else { echo "<ol class=\"child\" id=\"comment" . $commentid . "replies\">\n"; } while ($child = mysql_fetch_array($children)) { write_comment_thread($child['id'], $showcomments); } echo "</ol>\n</li>\n"; } echo "<!-- End comment {$commentid} replies -->"; }
function get_num_children($commentid) { $children = get_children_of_comment($commentid); return mysql_num_rows($children); }