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:

Archive /

Our old forums are still available as a read-only archive.

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

I'm confused...Could someone help me if they aren't busy?

Go to End

3 Posts   1465 Views


Community Member, 2 Posts

21 July 2008 at 5:25pm

Edited: 21/07/2008 5:56pm

Ok I also have just downloaded Silverstripe and let me say it is THE best site maker I have used. Anyway on to the prolem which is changing the Name of the site and Tagline. Someone else had a problem but the reply was confusing to me. How can I change the name and tagline from the CMS? Please help. Oh and I just notice I posted this in the wrong section. Sorry about that


Forum Moderator, 922 Posts

21 July 2008 at 7:06pm

Edited: 21/07/2008 7:12pm

1. First of all, create a special page type called HomePage - do this by creating a new file called HomePage.php inside mysite/code - this should be familiar if you've gone through the first two tutorials.

2. Create the HomePage extends Page class, as well as the HomePage_Controller extends Page_Controller class in the HomePage.php file.

3. Create two data fields on the HomePage class, that will be stored in the database. These will be the site name, as well as the tag line. We also create the form fields so you can edit the value in the CMS using getCMSFields() e.g.

class HomePage extends Page {

	static $db = array(
		'SiteName' => 'Varchar(100)',
		'Tagline' => 'Varchar(100)'

	function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->addFieldToTab('Root.Content.Main', new TextField('SiteName', 'Name of site'));
		$fields->addFieldToTab('Root.Content.Main', new TextField('Tagline', 'Tagline of site'));

		return $fields;

class HomePage_Controller extends Page_Controller {


4. Run db/build?flush=1, and in the CMS, make sure the "Home" page has the page type "Home Page" (see the Behaviour tab whilst on the page.

5. Open up Page.php, and add two functions. These functions take an instance of HomePage and return the SiteName and Tagline data fields, assuming you'll only ever have one home page. e.g.

class Page extends SiteTree {

	function SiteName() {
		$homePage = DataObject::get_one('HomePage');
		return $homePage ? $homePage->SiteName : false;

	function Tagline() {
		$homePage = DataObject::get_one('HomePage');
		return $homePage ? $homePage->Tagline : false;

class Page_Controller extends ContentController {


6. Open up themes/blackcandy/templates/ and look for "Your Site Name". Replace that text with $SiteName.

7. Do the same as 6), looking for "Your site's tagline here", replacing it with $Tagline

I'll probably add this to the wiki if there's not already a recipe on there for doing this.

Hope this helps!



Forum Moderator, 5523 Posts

23 July 2008 at 5:38pm

or if you dont need to edit the Site name from the CMS (this is currently not supported - you have to edit the template file)

Open themes/ the theme name /templates/ in a text editor (eg Notepad) and edit the Your Site Name String