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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Best Practices Extending SiteTree

Go to End

4 Posts   1059 Views


Community Member, 545 Posts

31 July 2013 at 7:18am

Just wondering if there any Best Practices in SS3.1 when adding DataExtensions to the base Page. Is it better to add the DataExtension to SiteTree or to Page?


Community Member, 189 Posts

31 July 2013 at 7:33am

I always add my DataExtension to Page. In the almost 3 years I've been developing with SS I've never created a new page type that extended SiteTree.

not sure if there is a best practice but this what I've always done.


Community Member, 545 Posts

31 July 2013 at 12:13pm

I'm thinking more in terms of adding features to the basic Page as opposed to creating new Page types. I was thinking doing it to SiteTree to save creating another an extra Table. If you add the DataExtentsion to Page it creates a Page Table for the new fields, but if you add it to SiteTree it just adds the extra fields to the SiteTree table. I figure that way it saves a DataBase call, and a table. But I was wondering if there's a conflict with any intended design patterns

Optic Blaze

Community Member, 190 Posts

24 April 2014 at 8:43am

Hi there,

Have any of you worked further on this. I am battling to extend the controller associated with SiteTree. I cant seem to get the form to show on my pages:


class SidebarEmail_Controller extends Extension {

public static $allowed_actions = array (

public function EnquiryForm(){
$fields = new FieldList(
new TextField('Name', 'Your name & surname:'),
new TextField('Tel', 'Your phone number:'),
new EmailField('Email', 'Your email address:'),
new TextAreaField('Comments', 'Your query/comment:'),
new RecaptchaField('MyCaptcha')
//Form Action
$actions = new FieldList(
new FormAction('SendContactForm', 'Submit')
//Create Validators
$validator = new RequiredFields('Name', 'Email', 'Comments');
//Create form
$form = new Form($this, 'EnquiryForm', $fields, $actions, $validator);
return $form;