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.

Customising the CMS /

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

Entire site crashes when I upload CMS field changes


Go to End


2 Posts   1674 Views

Avatar
evjan

Community Member, 7 Posts

5 October 2009 at 5:20am

Hello,

I've made some changes to the CMS fields and the database structure of a template of mine. It works just fine on my machine, but when I upload it to my test server, the entire site crashes. I can't go to the admin login, I can't reach dev/build or anything, it just gives me:

"Website Error
There has been an error

The website server has not been able to respond to your request."

for every page I try to access. When I replace the php file in mysite/code with the old one, everything starts working again. What have I done wrong? This is the code that I've modified:

class StartPage extends SiteTree {
	
	public static $db = array(
		'Puff1titel' => 'Varchar',
		
		'Puff1kolumn1titel' => 'Varchar',
		'Puff1kolumn1text' => 'Text',
		
		'Puff1kolumn2titel' => 'Varchar',
		'Puff1kolumn2text' => 'Text',
		
		'Puff2titel' => 'Varchar',
		'Puff2kolumntitel' => 'Varchar',
		'Puff2text' => 'Text'
	);
	
	public static $has_one = array(
		"Puff1kolumn1link" => "SiteTree",
		"Puff1kolumn2link" => "SiteTree"
	);
	
	function getCMSFields() {
	   $fields = parent::getCMSFields();

	   $fields->addFieldToTab('Root.Content.Main', new TextField('Puff1titel'), 'Content');
	
	   $fields->addFieldToTab('Root.Content.Main', new TextField('Puff1kolumn1titel'), 'Content');
	   $fields->addFieldToTab('Root.Content.Main', new TextareaField('Puff1kolumn1text'), 'Content');
	   $fields->addFieldToTab("Root.Content.Main", new TreeDropdownField("Puff1kolumn1linkID", "Puff1kolumn1link", "SiteTree"));
	
	   $fields->addFieldToTab('Root.Content.Main', new TextField('Puff1kolumn2titel'), 'Content');
	   $fields->addFieldToTab('Root.Content.Main', new TextareaField('Puff1kolumn2text'), 'Content');
	   $fields->addFieldToTab("Root.Content.Main", new TreeDropdownField("Puff1kolumn2linkID", "Puff1kolumn2link", "SiteTree"));
	
	   $fields->addFieldToTab('Root.Content.Main', new TextField('Puff2titel'), 'Content');
	   $fields->addFieldToTab('Root.Content.Main', new TextField('Puff2kolumntitel'), 'Content');
	   $fields->addFieldToTab('Root.Content.Main', new TextareaField('Puff2text'), 'Content');
	   
	   $fields->removeFieldFromTab('Root.Content.Main', 'Content');
	
	   return $fields;
	}
	
}

Avatar
Willr

Forum Moderator, 5523 Posts

5 October 2009 at 4:42pm

Turn on dev mode to see the full error message. Its will probably explain more about what the error is. Turn devmode on by adding this to your _config.php file

Director::set_environment_type("dev");