Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: Comments counter
Pages: [1]   Go Down
  Print  
Author Topic: Comments counter  (Read 991 times)
0 Members and 2 Guests are viewing this topic.
trusco1973
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« on: December 13, 2011, 17:24:47 »

Hi, I'm developing a blog similar joomla site using that cool component.
I need to show comments total count in the frontpage, category list and article page.
The strange thing is that in the category list article I found a way in that forum and I already show that magic number.
I'm using in the directory components/com_content/views/category/tmpl/blog_item.php that code
Code:
<?php 
        
$commentsCount 0;
        $commentsBlock '';
$commentsAPI JPATH_SITE.DS.'components'.DS.'com_jcomments'.DS.'jcomments.php';
if (is_file($commentsAPI)) {
require_once($commentsAPI);
$config = & JCommentsFactory::getConfig();
$categoryEnabled JCommentsContentPluginHelper::checkCategory($this->item->catid);

if ($categoryEnabled) {
$commentsCount JComments::getCommentsCount($this->item->id'com_content');
if ($commentsCount) {
$commentsBlock '<span class="comments-counter"><a href="'.$this->item->readmore_link.'#comments">'.$commentsCount."</a></span>";
} else {
$commentsBlock '<span class="comments-counter"><a href="'.$this->item->readmore_link.'#addcomment">'."0</a></span>";
}
}
}
?>
Clearly I remove the if $categoryEnabled but it doesn't work. And the article page too.
Is there someone who knows how can I solve?
Thanks
Tru
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: December 13, 2011, 21:08:25 »

The category view and article view have different variables so if you're insert code to blog_item.php, you have to use $this->item->id, if you're insert code to article's view - $this->artcile->id...
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Suggestions, Wishlists & Feature Requests    Topic: Comments counter
 
Jump to: