Page Hit Counter for EVO implemented...plugin
And this PHP snippet:
<?php
$prefix = $modx->dbConfig['table_prefix'];
$page = '';
$page_id = isset($id) ? $id : $modx->documentObject['id'];
$sql = "SELECT page_count FROM " .$prefix. "page_hit_counter WHERE page_id ='" .$page_id."'";
$rs = $modx->db->query($sql);
$row = $modx->db->getRow($rs);
$count = $modx->recordCount($rs);
if ($count < 1) {
$page .= "Page views: 0";
} else {
$page .= "Page views: " . $row['page_count'];
}
return $page;
?>
The counter works well for all pages.
Now I want to include the counts on a summary page as well.
For example... page 1 - counts 4 page 3 - counts 9 page 4 - counts 18
The summary page lists the title and introtext of all those three articles. Together with that I also want to show the page view counts.
So: Summary page: synopsis of page 1 (counts 4), synopsis of page 3 (counts 9), synopsis of page 4 (counts 18)
For this I have...
<p><i class="fa fa-eye"></i>[~[+id+]~][!pageCount!]</p>
But the output of that is only the title text + [!pageCount!] but no value.
I cannot understand why no value shows?
Please use the id parameter of the pageCount snippet
class="fa fa-eye"></i>[~[+id+]~][!pageCount? &id=`[+id+]`!]</p>