10 Sep 2010 
Support Center » Knowledgebase » Display number of comments
 Display number of comments
Article We have a function named countComments( $id ) which accepts one optional parameter - ID of the article being commented. Leave it as null to use already defined $id in $comments object, or path of current PHP page. Default: null (recommended for most users)

You can call this function from $comments object, something like this: $comments->countComments($id);
The function returns value which can be assigned to PHP variable or printed on screen, so your code may look something like this:

-------[ code ]---------------------------------------
<?php
printf('Total: %1$d comment(s)', $comments->countComments());
?>
-------[ code ]---------------------------------------



Article Details
Article ID: 5
Created On: 02 Dec 2009 11:35 PM

 This article was helpful  This article was not helpful

 Back
 Log in  
Username:
Password:
Remember Me:
 
 Search
 Article Options
Home | Knowledgebase | Troubleshooter | News | Downloads
Language:

Helpdesk Software by Kayako SupportSuite v3.50.06