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.

Code samples

Let's assume you had a website with 'normal' pages and now wanted some other pages that displayed biographies for people working at a company. You can use SilverStripe Framework to extend the normal pages into staff pages, and add new fields, such as role, email address, photo, etc:

class StaffPage extends Page {
private static $db = array(
'Role' => 'Text'
private static $has_one = array(
'StaffPhoto' => 'Image'

public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Staff', TextField::create("Role"));
$fields->addFieldToTab('Root.Staff', UploadField::create("StaffPhoto", "Staff photo"));
$fields->addFieldToTab('Root.Staff', TextField::create("Role")); $fields->addFieldToTab('Root.Staff', UploadField::create("StaffPhoto"));

return $fields;

The above will automatically do a number of things:

To see more code, we suggest: