Hi Concreters
i made a little peace of code to count the number of view for some pages. i had create a number attribute and write this
<?php
$page_count = $c->getAttribute('page_count');
if (!$cp->canAdminPage()) { //update only if not connected as editor
$c->setAttribute('page_count', $page_count + 1);
}
echo $page_count;
?>
it works, each page displaying increase the number but i don’t know why it’s reseting alone sometimes.
is someone know why or have a better solution to do this ?
i had using attributes because it’s a good and simple way to catch the number in page list block for exemple.
see you