This document contains information for an outdated version and may not be maintained any more. If some of your projects still use this version, consider upgrading as soon as possible.

SiteConfig: Global database content


The SiteConfig panel provides a generic interface for managing site wide settings or functionality which is used throughout the site. Out of the box it provides 2 fields 'Site Name' and 'Site Tagline'.

Accessing SiteConfig Options

You can access SiteConfig options from any SS template by using the function $SiteConfig.FieldName


// or 

<% loop $SiteConfig %>
$Title $AnotherField
<% end_loop %>

Or if you want to access variables in the PHP you can do

$config = SiteConfig::current_site_config(); 


Extending SiteConfig

To extend the options available in the panel you can define your own fields via an Extension.

Create a mysite/code/CustomSiteConfig.php file.


class CustomSiteConfig extends DataExtension {

    static $db = array(
        'FooterContent' => 'HTMLText'

    public function updateCMSFields(FieldList $fields) {
        $fields->addFieldToTab("Root.Main", new HTMLEditorField("FooterContent", "Footer Content"));

Then add a link to your extension in the _config.php file like below.

Object::add_extension('SiteConfig', 'CustomSiteConfig');

This tells SilverStripe to add the CustomSiteConfig extension to the SiteConfig class.

After adding those two pieces of code, rebuild your database by visiting and then reload the admin interface. You may need to reload it with a ?flush=1 on the end.

You can define as many extensions for SiteConfig as you need. For example if you are developing a module you can define your own global settings for the dashboard.

API Documentation


Was this article helpful?