By Wim on Wednesday, 11 January 2017
Posted in General Issues
Replies 4
Likes 0
Views 495
Votes 0
Hi,

I know on article blog item pages I can show the number of comments for an article.

Is it also possible to do this for a article category list?
And is this also possible for J! core modules displaying a list with articles?
Hi there,

Is it also possible to do this for a article category list?

It is possible to shown those numbers of comments if your menus is to shown single category list, but if you want to show on all categories layout, currently we cant achieved that.

And is this also possible for J! core modules displaying a list with articles?

You have to consult with J! core module service provider regarding this issues.

Please advice.
·
Thursday, 12 January 2017 13:32
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey Warith,

Thanks for your reply.

Perhaps it would be possible to create a custom plugin to get the number of comments for an item. Are there any code examples to get the number of comments from the database/component?

I don't mind a bit of coding but it would be great to get some input before i get started.

Wim
Wim
·
Thursday, 12 January 2017 15:34
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Wim,

Here is the example of codes to get the comment count:

$model = KT::model('comments');
$count = $model->getCount('com_content', 2, array());


the getCount() parameters are:
- 'com_content' (the component name)
- 2 (the article ID)
- array() (the array of options that you can pass. you can see this file ../administrator/components/com_komento/models/comments.php on line 77)

Hope this helps.
·
Thursday, 12 January 2017 17:11
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post