Search Results - Searched for: Hits counter when using Jotcache

27 Nov 2014 13:51

Hits counter 3 months 3 hours ago


Joomla! caches the hit count. That is why you are seeing an offset between these values.

This post will help you get past this.
24 Nov 2014 17:55
Andi Setyaji
Thanks for your reply Mr. Krikor. Sorry, I still do not understand. I use K2 v.2.6.8, joomla v 2.5.27. Where the line, code is inserted?

My regards,
24 Nov 2014 14:42
In the item.php.
More information on overrides can be found here:
24 Nov 2014 14:10
Andi Setyaji
Sorry, I am new in K2 and Joomla. I also had the same problem.
May I ask, where the code is entered?
02 Jun 2014 12:17
You also need to set "Parse PHP code" to "yes".
31 May 2014 00:02
BIG BIG Thnx Lefteris Kavadas
I try with K2 tools custum code. Put this code in module, set module to desidered position, excluded this position from caching, but no result. Hit are not increased by +1
Is code good. I have latest K2 and latest joomla 3.3
Big Thnx
30 May 2014 12:54
@Petar Grgurev

I cannot know why this does not work. I was just asked to provide some code. I don't even know how Jotcache works. K2 includes also a module for custom code. Try to use that.
30 May 2014 00:31
What module use for php code
I try Blank module and Flexi custum code, put code you write above, exclude position in Jotcache, But does not work
Please help
24 May 2014 03:51
Hello! Would you be so kind as to share the module that has developed? Because my great ignorance did not allow me to implement it myself.
Thank you!
23 May 2014 18:18
You are welcome.
23 May 2014 16:17
Thank you verry much!!!!

This worked for me!

I installed a custom code module.
insert this code and exclude this module position from being cached.

Now every time the k2 item page is recached, the new hits are displayed correct.
23 May 2014 12:02
According to the link you provided the code should be:
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

if (isset($_GET['view']) && strtolower($_GET['view']) == 'item') {
 $articleId = (int) $_GET['id'];
 $db = JFactory::getDBO();
                        'UPDATE #__k2_items' .
                        ' SET hits = hits + 1' .
                        ' WHERE id = '.(int) $articleId

22 May 2014 13:52
Ok, I will try to figure out how to modify the query for K2 items.

Yes I know that the amount of hits is to provide a general image of the item popularity, but it looks strange when a webpage has serveral thousands hits, a main article only showed up 62 hits.

I think there are more people with this problem, and looking for a solution.
22 May 2014 13:00
Hi. Yes if it works for Joomla! articles it can also work for K2 items. You just need to modify the query so it updates the K2 items table. In general, hits are there to provide a general image of the item popularity, not to provide accurate statistics. For such usage you are suggested to use a tool like Google Analytics.
21 May 2014 22:31

Hits counter when using Jotcache 9 months 5 days ago


I'm looking for a solution to use full page caching (jotcache), but still counting and display the total hits.

When I activate the jotcache full page caching, the number of hits will only count up once in a while when the page cache is expired and have to be recached.

for normal Joomla! articles, I found a good solution, described in the topic below:

Joomla forum hits counter with full page cache

Is there a way to implement this solution for K2 items?
Displaying 1 - 15 out of 15 results.
Powered by Kunena Forum