JComments - put comments count in template

More
14 years 4 months ago - 11 years 9 months ago #7976 by skipjack
Hi there!

I am using Dominion template (check here: demo.rockettheme.com) and I have some problems since I installed FlexiContent.
By default I can see the number of comments on the frontpage blog layout. Since I installed FlexiContent the number of comments is 0 at every article although there are some comments.
I checked the php file and found this line:
Code:
$jcomment_count = JComments::getCommentsCount($this->item->id, 'com_content');

and this:
Code:
<div class="rt-comment-block"> <a href="<?php echo $this->item->readmore_link; ?>#comments" class="rt-comment-badge"> <span class="rt-comment-count"><?php echo $jcomment_count; ?></span> <span class="rt-comment-text"><?php echo JText::_('COMMENTS'); ?></span></div>

I would like to know how could I modify the code in order to show correctly the number of comments?

Thank you very much in advance!
Last edit: 11 years 9 months ago by kenmcd. Reason: made title more descriptive, then moved to Templates forum

Please Log in or Create an account to join the conversation.

More
14 years 4 months ago #8233 by chessman
Did you read about flexicontent template system ?

try this :
Code:
$jcomment_count = JComments::getCommentsCount($this->item->id, 'com_flexicontent');
instead of :
Code:
$jcomment_count = JComments::getCommentsCount($this->item->id, 'com_content');

www.christophehagnere.fr <= entièrement réalisé avec FLEXIcontent
www.joomla.fr <= Co-administrateur

Please Log in or Create an account to join the conversation.

  • Anonymous
  • Visitor
  • Visitor
14 years 3 months ago #8991 by Anonymous
Replied by Anonymous on topic JComments - put comments count in template
Hi,

I'm trying to implement this comment counter from JComments on the category view as well. I can't figure out which file to put this code you specified in though. I tried putting it in the "blog" template that comes with flexicontent by default in template/blog/category_items.php. It isn't working though and it just breaks the page. I put this code next to the read more in this file:

<?php $jcomment_count = JComments::getCommentsCount($this->item->id, 'com_flexicontent'); ?>

Please Log in or Create an account to join the conversation.

  • Anonymous
  • Visitor
  • Visitor
14 years 2 months ago #9521 by Anonymous
Replied by Anonymous on topic JComments - put comments count in template
anybody know how to fix this? I tried the code above but it didn't work

Please Log in or Create an account to join the conversation.

More
11 years 9 months ago #33129 by gauthier
this solution works fine in category_items.php, here my code:
Code:
$count = JComments::getCommentsCount($item->id, 'com_flexicontent');

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.340 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline