Thanks Willr,
I did like this:
In class Page
public static $db = array(
'ShowInTopMenu' => 'Boolean',
'ShowInLeftMenu' => 'Boolean',
'ShowInLeftMenu2' => 'Boolean',
'visits' => 'Int'
);
In class Page_Controller
function totalVisits()
{
return DB::query("SELECT SUM(visits) FROM page_live")->value();
}
public function init()
{
parent::init();
Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
$this->visits++;
$this->write();
}
And in template the $totalVisits variable show 0. I think that this line >> $this->visits++; << does not work because in database I noticed that whatever page I display value of visits is always 0.
Please, help where is the mistake.
Thanks!