x
 
Create New Page
 View Previous Changes    ( Last updated by Lisa Wess )

Total Comments for Weblog and Gallery

Question:

How can I show the total comments for the weblog and gallery?

Answer:

global $DB;

$query = $DB->query("SELECT COUNT(comment_id) AS ccount FROM exp_comments WHERE status = 'o'");

$results = $DB->query("SELECT COUNT(comment_id) AS gcount FROM exp_gallery_comments WHERE status = 'o'");

echo
$query->row['ccount'] + $results->row['gcount'];

PHP Parsing will need to be on for this to work, of course.

Category:Comments Category:Templates

Categories: