News Show Pro GK4 & JComments with Joomla 2.5

Free responsive Joomla 2.5 and 3.x module to present your content with easy and intuitive way.
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Wed Sep 11, 2013 6:14 pm
I have been working to migrate our site to a Gavick template, trying to get the same look and feel. The template uses News Show Pro GK 4. I replicated the look, taking advantage of the template demo for all the appropriate settings. But, I needed to add one thing... JComments.

When I learned that NSP GK4 on J!25 did not have JComments support, I tried to switch to News Show Pro GK5. It worked great, except the styles changed from GK4 to GK5. So, I was going to have re-work all the styling to achieve the look of the Gavick template demo.

So, I thought that I would try to add JComments support to NSP GK4 on J!25.

In modules/mod_news_pro_gk4/tmpl/layout.parts.php, I took the following code from the J!15 version of NSP GK4 (v 2.3.3), lines 132-155 and 159

Code: Select all
// JComments support
$jcomments_count = '';   
$jcomments_main_class = JPATH_SITE . '/components/com_jcomments/jcomments.php';
$jcomments_content_class = JPATH_SITE . '/components/com_jcomments/helpers/content.php';
if (file_exists($jcomments_main_class) && file_exists($jcomments_content_class)) {
     require_once($jcomments_main_class);
     require_once($jcomments_content_class);
     $finded_numbers = explode(':', $news_cid);
     if (JCommentsContentPluginHelper::checkCategory($finded_numbers[0])) {
          $jcomments_count = JComments::getCommentsCount($news_id, 'com_content');
      }   
}
// end of JComments support block
$info_comments = '';
if($jcomments_count !== '') {
     if($config['no_comments_text'] && $jcomments_count == 0){
           $info_comments = '<a class="nsp_comments" href="'.JRoute::_(ContentHelperRoute::getArticleRoute($news_id,$news_cid, $news_sid)).'#comments">'.JText::_('NO_COMMENTS').'</a>';
     } else {
          $info_comments = '<a class="nsp_comments" href="'.JRoute::_(ContentHelperRoute::getArticleRoute($news_id,$news_cid, $news_sid)).'#comments">'.JText::_('COMMENTS').'('.$jcomments_count.')</a>';
      }
}
//
$info_rate = ($rating_count > 0) ? '<span class="nspRate">' . JText::_('MOD_NEWS_PRO_GK4_NSP_RATE') .' '. number_format($rating_sum / $rating_count, 2) . '</span>': '';
//
$news_info = str_replace('%AUTHOR', $info_author, $news_info);
$news_info = str_replace('%COMMENTS', $info_comments, $news_info);         
$news_info = str_replace('%DATE', $info_date, $news_info);
$news_info = str_replace('%HITS', $info_hits, $news_info);
$news_info = str_replace('%CATEGORY', $info_category, $news_info);
$news_info = str_replace('%RATE', $info_rate, $news_info);


and I inserted into the same approximate position in layout.parts.php of the J!25 version News Show Pro GK4 (v 3.1.4), around line 156.

And, this seemed to work. This seemed too easy. Is there anything else that I need to consider? Am I missing something?
User avatar
Fresh Boarder

GK User
Thu Sep 12, 2013 7:51 am
Is there anything else that I need to consider? Am I missing something?


Proably you pass over comments settings in XML file, but this is probably all.
User avatar
Platinum Boarder

GK User
Thu Sep 12, 2013 6:34 pm
Thank you for taking a look at my post.

Are you talking about the 'no_comments_text' (Show other text when no comments) parameter?
User avatar
Fresh Boarder

GK User
Mon Sep 16, 2013 7:46 am
Yes, $config['no_comments_text' is the only part from configuration so from XML file.
User avatar
Platinum Boarder


cron