Jeff VIP
Total posts: 745
07 May 2013 23:12

Hi,

which code should I use to insert the number of comments in the template?

I have seen this

$details[] = sprintf('%s: %s', JText::_('CCOMMENTS'), CommentHelper::numComments($obj->submission_types[$item->type_id], $item));

            }

but I can't just cut and paste this somewhere else.

Best regards,

Jeff

Last Modified: 21 Nov 2014


Sackgesicht VIP
Total posts: 1,636
07 May 2013 23:33

If you are referring to an intro/list template, i use

echo $item->comments

Jeff VIP
Total posts: 745
07 May 2013 23:47
echo $item->comments

That didn't work for me :(

Maybe because I use Komento?


Sackgesicht VIP
Total posts: 1,636
07 May 2013 23:57

Most probably.

I use the Cobalt comments ....


Jeff VIP
Total posts: 745
08 May 2013 00:05

Yes, you are right. I shall report this as a bug.

Thanks


Sergey
Total posts: 13,748
08 May 2013 02:51

There is only one what to show correct comments numbers

For article list

CommentHelper::numComments($this->submission_types[$item->type_id], $item));

For full article.

CommentHelper::numComments($this->type, $item));

As fo Komento latest version will also work with $item->comments but you will need to add at least one comment to article after installing latest version of komento adapter and komento itself.


Jeff VIP
Total posts: 745
08 May 2013 04:09

Thanks Sergey,

CommentHelper::numComments($this->submission_types[$item->type_id], $item));

 echo $details[] = sprintf('%s: %s', JText::_('CCOMMENTS'), CommentHelper::numComments($obj->submission_types[$item->type_id], $item)); 

to be precise :) But it still didn't work for me. See this thread


Sergey
Total posts: 13,748
08 May 2013 07:20

That is because it shows comments like in new komento. You will need to update it. They said they are releasing new version today.


jimie VIP
Total posts: 531
20 Nov 2014 19:21

Hey Sergey,

When I use:

<?php echo CommentHelper::numComments($this->submission_types[$item->type_id], $item); ?>

The comments number includes also the number of unpublished comments, how can I make it to show only the number for published comments ?


Konstantin
Total posts: 1,113
21 Nov 2014 04:38

Fixed.

Powered by Cobalt