which versoin are you using, I am using 2.23.......not sure if this would work with 2.3, it should but I havn't got round to testing much on that version.
here is my code:
SidebarPage.php
<?php
class SidebarPage extends Page {
static $db = array(
'SidebarText' => 'Text'
);
static $has_one = array(
'Image1' => 'Image',
'Image2' => 'Image',
'Image3' => 'Image',
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextAreaField('SidebarText'), 'Content');
$fields->addFieldToTab("Root.Content.Images", new ImageField('Image1'),'Content');
$fields->addFieldToTab("Root.Content.Images", new ImageField('Image2'),'Content');
$fields->addFieldToTab("Root.Content.Images", new ImageField('Image3'),'Content');
return $fields;
}
}
class SidebarPage_Controller extends Page_Controller{
}
?>
Page.php:
<?php
class Page extends SiteTree {
static $db = array(
);
}
class Page_Controller extends ContentController {
function GetSidebar() {
return DataObject::get_one("SidebarPage");
}
}
?>
Sidebar.ss
<% control GetSidebar %>
$SidebarText
$Image1
$Image2
$Image3
<% end_control %>
Page.ss
<% include Sidebar %>