Hi. I've got a strange problem. I've been adding fields to my page classes via their PHP files, and now I can't anymore. Basically, if I add a new field on ANY page and do a build (dev/build/) I get an incomplete log page, and accessing the site results in a blank page. If I remove the lines of code that I just entered, the build goes forward and the site works again. Here's the specific code I'm changing:
Initial code:
class HomePage extends Page {
static $db = array(
'HomeTitle' => 'Varchar(50)'
);
static $has_one = array(
'FeatImage' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('FeatImage'));
$fields->addFieldToTab('Root.Content.Main', new TextField('HomeTitle'), 'Content');
return $fields;
}
}
Nonworking code with new field definition:
class HomePage extends Page {
static $db = array(
'HomeTitle' => 'Varchar(50)'
'HomeSubtitle' => 'Varchar(50)'
);
static $has_one = array(
'FeatImage' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('FeatImage'));
$fields->addFieldToTab('Root.Content.Main', new TextField('HomeSubtitle'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('HomeTitle'), 'Content');
return $fields;
}
}
I'm just following the prescribed format, and have successfully added multiple forms to other pages this way. Any ideas?
Thanks
-PM
EDIT: Given the place that the build log page ends, it looks like the build is hanging on creating the tables for the HomePage. Not sure why this would be happening...