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?