Silverstripe 4
Hello all, please for the love of god help me i need help, please help.
With that attractive clingy frustration out of the way, I have this issue.
While trying to get our site working again after the PHP update catastrophe, I upgraded to Silverstripe 4. After a long and hard fight, uphill, I have this one Issue left.
Our homepage used to Get a Footer from trough either the PageController or the ContentController - due to a shabby backup culture the original has been lost. However revised versions worked - here is the code that used to work under silverstripe 2 - 3 ish. (#Hire me)
class Page extends SiteTree {
private static $db = array (
'MyTitle' => 'Varchar'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TextField::create('MyTitle','MyTitle'),'Content');
return $fields;
}
private static $has_one = array(
'Footer' => 'Footer' );
}
class Page_Controller extends ContentController {
public function GetFooter(){
$Footer = DataObject::get_one('Footer');
return $Footer;
}
private static $allowed_actions = array (
);
public function init() {
parent::init();
}
}
So thats a snippet of the file with the useless stuff removed.
<% control GetFooter%>
<p>$MyTitle</p>
<% end_control %>
Now i fixed the old array syntax and put the classes in a common namespace. But its the latter code in the page.ss thats giving me errors. ( Error was: Unknown closed block “control” encountered. Perhaps you are not supposed to close this block, or have mis-spelled it?)
I can only guess that control being used in this way has been deprecated, or maybe changed. OR MAYBE I’M AN IDIOT ! This is maybe most likely in any event.
I can only hope that some good samaritan on this forum can save me from eating my keycaps in frustration.
Thanks in advance !
Edit i should mention that the Footer is a .ss in the layout folder. and works on Its own in the editor - but i have not successfully included with data(yes when moved to include folder) as a footer to the main page.