your welcome :)
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.
- Previous 10 entries
- 1
- Page 22(current)
hi ,
First of all , Thanxs aram , Ur tuts helped a lot....
I m new to silver stripe.........
i got a problem with my footer.... i wanted a static footer that means it should be editable at admin end and same for all pages. Once i change the content it shld get updated for all pages.
I made a page type called footer.php like you said . Here is my code...
<?php
class Footer extends Page {
static $db = array(
'FooterLink' => 'HTMLText',
);
static $has_many = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new HtmlEditorField('FooterLink'), 'FooterLink');
$fields->removeFieldFromTab("Root.Content.Main","Content");
return $fields;
}
}
class Footer_Controller extends Page_Controller{
}
?>
and i put $FooterLink in page template "Page.ss " where i hav made my footer div. Now i placed the function which calls my "Footer.PHP" in Page type " Page.PHP ". Here is the code....
class Page_Controller extends ContentController {
public function GetFooter(){
return DataObject::get_one("Footer");
}
}
my sidebar is working g8.....but I cant work out how to get the footer ....
tell me , WHts wrong with my code ??
Hi Tomae, welcome to Silverstripe :)
I think the problem is the way you are calling footer in your template. When you return a DataObject like a Page as you do in your GetFooter() function you can call it in two ways. first would be like this:
<% control GetFooter %>
$FooterLink
<% end_control %>
The second would be like this:
$GetFooter.FooterLink
At the moment you are just calling $FooterLink so SS will be looking in the current Page class for the field FooterLink, but you want to tell SS that it needs to look in the DataObject that is returned by the function GetFooter().
cool.....it works......... thanx man.......
- Previous 10 entries
- 1
- Page 22(current)