Hello everyone, I'm using mod_k2_content on the homepage of my site to display articles. I want to show the article star rating system in the module to the right of where it says the number of hits.
I'm wondering if anyone knows what code I would insert into the modules/mod_k2_content/tmpl/Default/default.php file
I found the article rating code below in the components/com_k2/default/item.php file and played around with it a little but couldn't get the rating to match up with the articles rating.
<?php if($this->item->params->get('itemRating')): ?> <!-- Item Rating --> <div class="itemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <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; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php endif; ?><br>
If anyone has done this before any could provide the coding that would be great. I think putting it on the homepage it cant find the itemid to retrieve the rating from but that's just a guess.
thanks,
brett
I'm wondering if anyone knows what code I would insert into the modules/mod_k2_content/tmpl/Default/default.php file
I found the article rating code below in the components/com_k2/default/item.php file and played around with it a little but couldn't get the rating to match up with the articles rating.
<?php if($this->item->params->get('itemRating')): ?> <!-- Item Rating --> <div class="itemRatingBlock"> <span><?php echo JText::_('Rate this item'); ?></span> <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; ?>" title="<?php echo JText::_('1 star out of 5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('2 stars out of 5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('3 stars out of 5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('4 stars out of 5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('5 stars out of 5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php endif; ?><br>
If anyone has done this before any could provide the coding that would be great. I think putting it on the homepage it cant find the itemid to retrieve the rating from but that's just a guess.
thanks,
brett