Forum
Welcome, Guest
Please Login to access forum.
Re:Include comments count into featured articles (1 viewing) 
Go to bottom
TOPIC: Re:Include comments count into featured articles
#8142
John Dagelmore
Admin
Posts: 3873
User Offline
Re:Include comments count into featured articles Karma: 84  
The code for Joomla 6/5/4 is the following one:

Code:

require_once (JPATH_ROOT . '/components/com_jcomment/classes/config.php'); 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; Factory::getApplication ()->input->set ( 'view', 'article' ); $count = JCommentModel::getCommentsCount ( $options ); Factory::getApplication ()->input->set ( 'view', 'featured' ); $link = Route::_ ( Joomla\Component\Content\Site\Helper\RouteHelper::getArticleRoute ( $this->item->slug, $this->item->catid, $this->item->language ) ) . '#addcomments'; echo '<a href="' . $link . '"><span class="icon-envelope"></span> ' . $count . ' comments - Add comment</a>';
 
Logged Logged  
  The administrator has disabled public write access.
Go to top