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.
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
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.
You could create a seperate DataObject and use ModelAdmin to admin the DataObject, or use this approach:
Can u give me a sample code because it not sidebar but footer.
Hope u can help
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: