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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

How to edit footer via cms...


Go to End


5 Posts   4421 Views

Avatar
Webdoc

Community Member, 349 Posts

26 November 2009 at 5:40am

Is there anyway possible to make the footer text editable via cms so that ot is in top menu near to security and others.

and how to display it in footer.ss file.

Avatar
Martijn

Community Member, 271 Posts

26 November 2009 at 6:07am

You could create a seperate DataObject and use ModelAdmin to admin the DataObject, or use this approach:

http://www.ssbits.com/create-a-static-sidebar/

Avatar
Webdoc

Community Member, 349 Posts

26 November 2009 at 6:24am

Can u give me a sample code because it not sidebar but footer.

Avatar
Webdoc

Community Member, 349 Posts

26 November 2009 at 6:28am

Hope u can help

Avatar
Martijn

Community Member, 271 Posts

26 November 2009 at 7:03am

Edited: 26/11/2009 7:05am

You could use the same code, but display it in the footer instead of the sidebar.

Or create a PageType like GlobalBlockPage.

And add in the static $db array ("Footer" => "Text", "OtherStaticText" => "Text" ); //etc

To ensure that the pagetype never show up in the menu add () to class GlobalBlockPage :

function onBeforeWrite () {
    if($this->ID){
        $this->record['ShowInMenus'] = 0;
    }
    parent::onBeforeWrite ();
}

To ensure you only have One GlobalBLockPage type add:

function canCreate() { 
		if(DataObject::get_one('GlobalBlockPage')) {
			return false;
		} else {
			return true;
		}
	}

In Page_Controller (not BlobalBlokPage) you do something like:

getFooter(){
   return DataObject::get_one("GlobalBlockPage")->FooterText;
}

or

getOtherStaticText(){
   return DataObject::get_one("GlobalBlockPage")->OtherStaticText;
}

Or call the whole object once and call getYourFunction.FooterText in the templates...

This should get you started.
Of Course you still can create DataObject and admin it with ModelAdmin and call that Object from Page to show it on the frontend:

http://doc.silverstripe.org/doku.php?id=modeladmin