В новой версии обстоят дела так (не копипаст, сама нашла в чем проблема):
В версии K2 2.2 файл components/com_k2/templates/item.php находится в components/com_k2/templates/
default/item.php
Это первая поправка, вторая, это в коде, строки с 499 по 586
<?php if($this->item->params->get('itemComments') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1'))):?>
<!-- K2 Plugins: K2CommentsBlock
<?php echo $this->item->event->K2CommentsBlock; ?>
<?php endif;?>
<?php if(
$this->item->params->get('itemComments')
&& !JRequest::getInt('print')
&& ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))
&& empty($this->item->event->K2CommentsBlock)
):?>
<!-- Item comments
<a name="itemCommentsAnchor" id="itemCommentsAnchor">
<div class="itemComments">
<?php if($this->item->params->get('commentsFormPosition')=='above' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
<!-- Item comments form
<div class="itemCommentsForm">
<?php echo $this->loadTemplate('comments_form'); ?>
</div>
<?php endif; ?>
<?php if($this->item->numOfComments>0 && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))): ?>
<!-- Item user comments
<h3 class="itemCommentsCounter">
<span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1)? JText::_('comments') : JText::_('comment'); ?>
</h3>
<ul class="itemCommentsList">
<?php foreach ($this->item->comments as $key=>$comment): ?>
<li class="<?php echo ($key%2)? "odd" : "even"; ?>">
<span class="commentLink">
<a href="<?php echo $this->item->link; ?>#comment<?php echo $comment->id; ?>" name="comment<?php echo $comment->id; ?>" id="comment<?php echo $comment->id; ?>">
<?php echo JText::_('Comment Link'); ?>
</span>
<?php if($comment->userImage):?>
<img src="<?php echo $comment->userImage; ?>" alt="<?php echo $comment->userName; ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" />
<?php endif; ?>
<span class="commentDate">
<?php echo JHTML::_('date', $comment->commentDate, JText::_('DATE_FORMAT_LC2')); ?>
</span>
<span class="commentAuthorName">
<?php echo JText::_("posted by"); ?>
<?php if(!empty($comment->userLink)): ?>
<a href="<?php echo $comment->userLink; ?>" title="<?php echo $comment->userName; ?>" rel="nofollow">
<?php echo $comment->userName; ?>
<?php else: ?>
<?php echo $comment->userName; ?>
<?php endif; ?>
</span>
<p><?php echo $comment->commentText; ?></p>
<span class="commentAuthorEmail">
<?php echo JHTML::_('Email.cloak', $comment->commentEmail, 0); ?>
</span>
<br class="clr" />
</li>
<?php endforeach; ?>
</ul>
<div class="itemCommentsPagination">
<?php echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('commentsFormPosition')=='below' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
<!-- Item comments form
<div class="itemCommentsForm">
<?php echo $this->loadTemplate('comments_form'); ?>
</div>
<?php endif; ?>
<?php $user = &JFactory::getUser(); if ($this->item->params->get('comments') == '2' && $user->guest):?>
<div><?php echo JText::_('Login to post comments');?></div>
<?php endif; ?>
</div>
<?php endif; ?>
Меняете на (вот это от
m__g)
<?php if($this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$comments = JPATH_BASE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($comments)) {
require_once($comments);
?>
<a name="itemCommentsAnchor" id="itemCommentsAnchor">
<?php
echo JComments::showComments($this->item->id, 'com_k2', $this->item->title);
}
?>
<?php endif; ?>
Ну со вторым файлом проблем не должно возникнуть по тем ссылкам, что выше дали, на всякий случай: Откройте файл components/com_k2/models/item.php и найдите функцию (строки 777 по 785):
function countItemComments($itemID){
$db = & JFactory::getDBO ();
$query="SELECT COUNT(*) FROM #__k2_comments WHERE published=1 AND itemID={$itemID}";
$db->setQuery($query);
$result = $db->loadResult();
return $result;
}
Меняете на:
function countItemComments($itemID){
$comments = JPATH_BASE . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($comments)) {
require_once($comments);
return JComments::getCommentsCount($itemID, 'com_k2');
}
return 0;
}
Вуаля, все работает.