Hi Everyone
I'm a newbie on Silverstripe and have a question. I created a SiteTree field in silverstripe and it shows up in my tab. However, when I choose a page from the sitetree and click save, it doesn't save anything. Here's the code in Page.php:
static $has_one = array(
'Photo' => 'Image',
'PhotoLink' => 'SiteTree',
'Photo2' => 'Image',
'PhotoLink2' => 'SiteTree',
'Photo3' => 'Image',
'PhotoLink3' => 'SiteTree'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$treedropdownfield = new TreeDropdownField("PhotoLink", "Choose a page that wish to link to:", "SiteTree");
$treedropdownfield2 = new TreeDropdownField("PhotoLink2", "Choose a page that wish to link to:", "SiteTree");
$treedropdownfield3 = new TreeDropdownField("PhotoLink3", "Choose a page that wish to link to:", "SiteTree");
$fields->addFieldToTab("Root.Content.RightImages", new ImageField('Photo'));
$fields->addFieldToTab("Root.Content.RightImages", new TextField('PhotoText'));
$fields->addFieldToTab("Root.Content.RightImages", $treedropdownfield);
$fields->addFieldToTab("Root.Content.RightImages", new ImageField('Photo2'));
$fields->addFieldToTab("Root.Content.RightImages", new TextField('PhotoText2'));
$fields->addFieldToTab("Root.Content.RightImages", $treedropdownfield2);
$fields->addFieldToTab("Root.Content.RightImages", new ImageField('Photo3'));
$fields->addFieldToTab("Root.Content.RightImages", new TextField('PhotoText3'));
$fields->addFieldToTab("Root.Content.RightImages", $treedropdownfield3);
return $fields;
}
As you can it's pretty simply, but why doesn't Silverstripe save the selected page?
And a second question when I succed in saving an internal page, how do I acces the site in my template Page.ss
Many thanx
Joel