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.

Customising the CMS

Entire site crashes when I upload CMS field changes


Reply

2 Posts   1171 Views

Avatar
evjan

5 October 2009 at 5:20am Community Member, 7 Posts

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

5 October 2009 at 4:42pm Forum Moderator, 5511 Posts

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");