1261 Posts in 350 Topics by 486 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2102 Views |
-
How to edit footer via cms...

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.
-
Re: How to edit footer via cms...

26 November 2009 at 6:07am
You could create a seperate DataObject and use ModelAdmin to admin the DataObject, or use this approach:
-
Re: How to edit footer via cms...

26 November 2009 at 6:24am
Can u give me a sample code because it not sidebar but footer.
-
Re: How to edit footer via cms...

26 November 2009 at 7:03am Last edited: 26 November 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:
| 2102 Views | ||
|
Page:
1
|
Go to Top |


