K2_content模块评分

问题描述:

我一直在重建category_item.php中的标准K2评分以查看评分,以显示为星号来显示为数字。K2_content模块评分

我做什么,我更换了这段代码:

<?php if($this->item->params->get('catItemRating')): ?> 
<div id="catItemRatingBlock"> 
<div class="itemRatingForm"> 
    <ul class="itemRatingList"> 
    <li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li> 
    <li><a href="#" rel="<?php echo $this->item->id; ?>" class="one-star">1</a></li> 
    <li><a href="#" rel="<?php echo $this->item->id; ?>" class="two-stars">2</a></li> 
    <li><a href="#" rel="<?php echo $this->item->id; ?>" class="three-stars">3</a></li> 
    <li><a href="#" rel="<?php echo $this->item->id; ?>" class="four-stars">4</a></li> 
    <li><a href="#" rel="<?php echo $this->item->id; ?>" class="five-stars">5</a></li> 
    </ul> 
    </div> 
    </div> 
<?php endif; ?> 

与此代码:

<?php if($this->item->params->get('catItemRating')): ?> 
<div id="catItemRatingBlock"> 
<div class="itemRatingForm"> 
    <?php 
    $rating_sum=0; 
    $rating_cont=0; 
    $db  =& JFactory::getDBO(); 
    $query='SELECT * FROM #__k2_rating WHERE itemID='. $this->item->id; 
    $db->setQuery($query); 
    $votes=$db->loadObject(); 

    $rating_sum = intval($votes->rating_sum); 
    $rating_count = intval($votes->rating_count); 
    $evaluate = ($rating_count==0) ? "0" : number_format($rating_sum/$rating_count,1); 

    $evaluate = str_replace('.0', '', $evaluate); 

    $output=" Rating: ". $evaluate."/5"; 
    echo $output; 
    ?> 
    </div> 
    </div> 
    <?php endif; ?> 

而且我要的是为它的K2模块的正常工作。我尝试使用上面编写的代码来实现它在k2内容模块中的功能,但这根本不起作用。

任何人都知道如何将它关闭?

更换

<?php if($this->item->params->get('catItemRating')): ?> 

有:

<?php if($params->get('catItemRating')): ?>