Hi all,
I have a website which I enabled the cache module to speed things up a bit. Which works wonders, but the only thing that bothers me is that the hit counter is not working properly anymore.
I use Conservative caching - Gzip and Jotcache.
I can imagine other people use the cache as well, and use the hit counter as well, so is there a solution to this?
EDIT:
Ok so there as a topic here on this forum regarding this issue. They provided me this:
To put this in the K2 Tools module and parse the PHP code. Unfortunately this does not work when caching is enabled. It seems to me that the actual code does not gets fired because the hits are not added. Also when I disable caching alltogether and refresh the page the hits should be doubled (the normal hit counter + this module) but unfortunately again, this does not happen. I think there is something wrong with this code. Could someone help me out?
I have a website which I enabled the cache module to speed things up a bit. Which works wonders, but the only thing that bothers me is that the hit counter is not working properly anymore.
I use Conservative caching - Gzip and Jotcache.
I can imagine other people use the cache as well, and use the hit counter as well, so is there a solution to this?
EDIT:
Ok so there as a topic here on this forum regarding this issue. They provided me this:
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
if (isset($_GET['view']) && strtolower($_GET['view']) == 'item') {
$articleId = (int) $_GET['id'];
$db = JFactory::getDBO();
$db->setQuery(
'UPDATE #__k2_items' .
' SET hits = hits + 1' .
' WHERE id = '.(int) $articleId
);
$db->query();
}
?>To put this in the K2 Tools module and parse the PHP code. Unfortunately this does not work when caching is enabled. It seems to me that the actual code does not gets fired because the hits are not added. Also when I disable caching alltogether and refresh the page the hits should be doubled (the normal hit counter + this module) but unfortunately again, this does not happen. I think there is something wrong with this code. Could someone help me out?
Edited 8 years 5 days ago by Uzi