Page 1 of 1

Number of comments on images

Posted: 15 Apr 2012, 11:12
by RuneMykle
Hiya Jan,

First off; Thanks a million! You're a gem! Doing this free for us other geeks are appreciated more than you can imagine and more than we probably ever will acknowledge you :)

I searched the forums here regarding showing the number of comments on an image in category view. The last post I found was more than a year old, where you wrote something that this is a requested feature that will come. As I can't find it I've got to ask; Do you still have plans to incorporate this into the gallery component?

The issue was regarding puling the info from jcomments as far as I could understand, but I got no clue if this is overcome.

Re: Number of comments on images

Posted: 02 May 2012, 21:11
by gblx
If you have jcomments installed and you want the number of comments in the category view with each image you need to add the following:

com_phcocagallery\views\category\tmpl\default_images.php - line 5 (at the top of the file)

Code: Select all

$comments = JPATH_SITE . DS .'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
com_phcocagallery\views\category\tmpl\default_images.php - line 8 (within the for loop for the image output)

Code: Select all

if (file_exists($comments)) {
  require_once($comments);
  $count = JComments::getCommentsCount($value->id, 'com_phocagallery_images');
}
$count is now the variable used to display the number of comments, so put in somewhere within the image output. If you're using the default template, the icon for comments is on line 259, so I'd put it somewhere in there.

This method works with JComments 2.3.0 and PhocaGallery 3.1.2.

Good luck!

Re: Number of comments on images

Posted: 04 May 2012, 13:02
by Jan
Hi, thank you for this guide.

Jan