21310 Posts in 5739 Topics by 2604 members
| Go to End | ||
| Author | Topic: | 1476 Views |
-
Re: Number of site displays

10 November 2010 at 1:51am
what is "dev servers list" it's the first time I hear it
-
Re: Number of site displays

10 November 2010 at 2:19am
in _config.php
Director::set_dev_servers(array(
'localhost',
'127.0.0.1',
'yourserver.com'
)); -
Re: Number of site displays

10 November 2010 at 4:45am Last edited: 10 November 2010 5:28am
listing is very long, please give me your IP and I add yours to give you the access. site is here http://87.207.57.202/boston/
here you can see code
class Page extends SiteTree {
public static $db = array(
'ShowInTopMenu' => 'Boolean',
'ShowInLeftMenu' => 'Boolean',
'ShowInLeftMenu2' => 'Boolean',
'visits' => 'Int'
);public static $has_one = array(
);
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Behaviour", new CheckboxField("ShowInTopMenu", "Pokaż w menu górnym"));
$fields->addFieldToTab("Root.Behaviour", new CheckboxField("ShowInLeftMenu", "Pokaż w menu lewym"));
$fields->addFieldToTab("Root.Behaviour", new CheckboxField("ShowInLeftMenu2", "Pokaż w menu lewym 2"));
return $fields;
}}
class Page_Controller extends ContentController
{
function topMenu()
{
$whereStatement = "ShowInTopMenu = 1";
return DataObject::get("Page", $whereStatement);
}
function leftMenu()
{
$whereStatement = "ShowInLeftMenu = 1";
return DataObject::get("Page", $whereStatement);
}
function leftMenu2()
{
$whereStatement = "ShowInLeftMenu2 = 1";
return DataObject::get("Page", $whereStatement);
}
function totalVisits()
{
return DB::query("SELECT SUM(visits) FROM page_live")->value();
}
public static $allowed_actions = array(
);public function init()
{
parent::init();Requirements::themedCSS('layout');
Requirements::themedCSS('typography');
Requirements::themedCSS('form');
//if( ?? cookie or session variable doesn't exist ?? )
//{
//?? create session or cookie ??$this->visits++;
$this->write();//}
}
}so the important is $this->visits++; in Page Controller and 'visits' => 'Int' in public static $db
-
Re: Number of site displays

12 November 2010 at 1:01am
there is no update query on visits in any page* table
| 1476 Views | ||
| Go to Top |


