On this project we use the K2 Component then select all the hits from the database and total them using the code below:


$db = JFactory::getDbo();
$db->setQuery(“SELECT `hits`
FROM `XXXX_k2_items`
WHERE 1 = 1;”);

$results = $db->loadObjectList();

foreach($results as $results1 => $result)
$hits += $result->hits;

echo $hits;


The K2 plugin from joomla counts the hits using it own internal control but our system validates the code for integrity.