J!Extensions Store™
Forum
Welcome, Guest
Please Login to access forum.
Include comments count into featured articles (1 viewing) 
Go to bottom
TOPIC: Include comments count into featured articles
#8092
John Dagelmore
Admin
Posts: 3644
User Offline
Include comments count into featured articles Karma: 78  
It's possible to show the comments count for example in the 'featured' view using a template override for the file 'templates/mytemplate/html/com_content/featured/default_item.php' and placing the following code at the bottom:

Code:

require_once(JPATH_ROOT . '/components/com_jcomment/classes/factory.php'); require_once(JPATH_ROOT . '/components/com_jcomment/classes/multilingual.php'); require_once(JPATH_ROOT . '/components/com_jcomment/models/jcomment.php'); $count = 0; $options = array(); $options['object_id'] = (int)$this->item->id; $options['object_group'] = 'com_content'; $options['published'] = 1; JFactory::getApplication()->input->set ( 'view', 'article' ); $count = JCommentModel::getCommentsCount($options); JFactory::getApplication()->input->set ( 'view', 'featured' ); echo '<span class="icon-envelope"></span> ' . $count . ' komentarzy';
 
Logged Logged  
  The administrator has disabled public write access.
Go to top