Keyword

how to remove parenthesis from votes number

  • Mojtaba
  • Mojtaba's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago #109495 by Mojtaba
hi
how to remove parenthesis from votes number?
is not possible form templates files or language files?

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #109496 by Jiliko.net
Replied by Jiliko.net on topic Re: how to remove parenthesis from votes number
Hi,

No, it's not possible as parenthesis are added in the K2 item model file (which is not the right place to do this).

If you want to achieve this without hacking K2, create a template override and add this php code in the template override file of the item (before html code starts) :
//Including item model file
require_once(JPATH_COMPONENT.DS.'models'.DS.'item.hp');
$model = new K2ModelItem();

//Getting item num of votes (only the value)
$vote = $model->getRating($this->item->id);

//Setting the new value with text
if (!is_null($vote))
  $rating_count = intval($vote->rating_count);
else
  $rating_count = 0;

$this->item->numOfvotes = $rating_count." ".( $rating_count > 1 ? JText::_('K2_VOTES') : JText::_('K2_VOTE') );

Please Log in or Create an account to join the conversation.

  • Mojtaba
  • Mojtaba's Avatar Topic Author
  • Offline
  • New Member
More
11 years 8 months ago #109497 by Mojtaba
thanks a lot.
you did great job.
its works fine.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum