Hey guys,
I have almost finished my first SilverStripe site for a client, however their final request has left me with a major headache.
I have been asked to add in a few extra fields into a particular page type... it already has 2 custom fields which I added in without any problems, however adding these new fields is leaving me with major problems - visiting /dev/build?=flush results in it stalling at the page before the one which is getting these new fields and visiting the main page results in a blank screen.
This is what I have in OurDogsPage.php:
<?php
/**
* Defines the OurDogs page type
*/
class OurDogsPage extends Page {
static $db = array(
'DogInfo' => 'HTMLText'
'DogInfoFather' => 'Text'
'DogInfoMother' => 'Text'
);
static $has_one = array(
'DogPhoto' => 'Image'
'DogPhotoFather' => 'Image'
'DogPhotoMother' => 'Image'
);
// Add this method under your static $db array bit.
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new ImageField('DogPhoto', 'Main Dog Photograph'));
$fields->addFieldToTab('Root.Content.Main', new HTMLEditorField('DogInfo', 'Dog Info'));
$fields->addFieldToTab('Root.Content.Lineage', new ImageField('DogPhotoFather', 'Dogs Father Photo'));
$fields->addFieldToTab('Root.Content.Lineage', new TextField('DogInfoFather', 'Dogs Father Name'));
$fields->addFieldToTab('Root.Content.Lineage', new ImageField('DogPhotoMother', 'Dogs Mother Photo'));
$fields->addFieldToTab('Root.Content.Lineage', new TextField('DogInfoMother', 'Dogs Mother Name'));
return $fields;
}
}
class OurDogsPage_Controller extends Page_Controller {
}
?>
The DogInfo and DogPhoto fields work fine. When I take out the DogInfoFather/Mother and DogPhotoFather/Mother code in the array at the start /dev/build and the site load fine (but without the fields obviously)
For the record my OursDogsHolder.php file simply contains:
<?php
class OurDogsHolder extends Page {
static $db = array(
);
static $has_one = array(
);
static $allowed_children = array('OurDogsPage');
}
class OurDogsHolder_Controller extends Page_Controller {
}
?>
I'm completely stumped as to where I have gone wrong and have worked through the tutorials sample code a half dozen times trying to find the mistake but I have no idea where it is.
Thanks for your help,
Stewart