Keyword

K2 AJAX and item hits

More
8 years 11 months ago #148590 by Makis
Replied by Makis on topic K2 AJAX and item hits
Hello,

Thank you for your reply.
Unfortunately is not working.
When you said 'Make sure that the option to execute PHP code is enabled,' where should I Find this?7
In the module or else?

Thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #148596 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 AJAX and item hits
Yes K2 Tools (custom code functionality) has this option.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 11 months ago #148599 by Makis
Replied by Makis on topic K2 AJAX and item hits
Hello Krikor,

I have done everything you said and unfortunately the script doesn't work.
I think that it cant find article id.
I tried to increase 1 to 100 and see if the hits change, but no luck.
I have also enabled cloudflare, is this a problem?

Thank you

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #148603 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 AJAX and item hits
That could be an issue since the output is cached The user is seeing a page generated from Cloudflare and not the actual item.

This is a known Joomla! issue (hits being cached) and I do not think that there is a solution available apart from that script.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

More
8 years 11 months ago #148664 by Makis
Replied by Makis on topic K2 AJAX and item hits
Hello again,

I think that there is another solution.
I managed to make some changes to the item.php on /website/templates/template_name/html/com_k2/templates/default
Around line 324 I add the code
<?php 
// REAL HITS
$oldhits=$this->item->hits;
$newhits=$oldhits * 8.5;
?>
That multiplies the real hits by 8.5 or whatever you want.
and also changed
<?php echo JText::_('K2_READ'); ?> <b><?php echo round($newhits,0); ?></b> <?php echo JText::_('K2_TIMES'); ?>
its 2-3 lines below to display the "multiplied" hits.
In that way you can see the real hits at the administrator side of joomla and at the front the "multiplied" hits in item view.
The same can be done in category view in the same folder.
So, the database is not altered in any way, just the displayed hits.
Hope that work for others also.

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


Powered by Kunena Forum