Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Number of site displays


Go to End


20 Posts   3034 Views

Avatar
sebastiankozub

Community Member, 59 Posts

10 November 2010 at 1:51am

what is "dev servers list" it's the first time I hear it :)

Avatar
bartvanirsel

Community Member, 96 Posts

10 November 2010 at 2:19am

in _config.php

Director::set_dev_servers(array(
	'localhost',
	'127.0.0.1',
	'yourserver.com'
));

Avatar
sebastiankozub

Community Member, 59 Posts

10 November 2010 at 4:45am

Edited: 10/11/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

Avatar
sebastiankozub

Community Member, 59 Posts

12 November 2010 at 1:01am

there is no update query on visits in any page* table

Go to Top