Number of comments on images

Phoca Gallery - image gallery extension
RuneMykle
Phoca Newbie
Phoca Newbie
Posts: 6
Joined: 01 Mar 2012, 20:04

Number of comments on images

Post 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.
gblx
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 02 May 2012, 20:53

Re: Number of comments on images

Post 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!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49150
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Number of comments on images

Post by Jan »

Hi, thank you for this guide.

Jan
If you find Phoca extensions useful, please support the project
Post Reply