I really have learned quite a bit from these forums, and from the great help at http://www.ssbits.com/.
However, I am having a really difficult time getting static side content to appear in my pages.
In the home page, the user needs to be able to modify the html for 3-4 varied content areas. One of these areas is the sidebar; the other 3 areas are locations where, if he has access to the html editor, he can use his limited html skills to enter other ads or whatever information he likes.
The rest of the pages are to default to the sidebar navigation that seems to be working fine.
The following is the code I've tried. Is there anyone out there who can help me with this?
(I'm using v2.3.2...)
___________________
StaticSidebar.php
<?php
class StaticSidebar extends HomePage {
static $db = array(
'SidebarHTML' => 'HTMLText'
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Useme", new HtmlEditorField( "SidebarHTML", "HTML Editor"));
return $fields;
}
}
class StaticSidebar_Controller extends HomePage_Controller{
}
?>
This successfully adds it to the CMS, giving me the option to create a new "Static Page."
___________________
HomePage.php (I also tried this in the Page.php to no avail)
<?php
/**
* Defines the GA HomePage page type
*/
class HomePage extends Page {
static $db = array(
);
static $has_one = array(
);
}
class HomePage_Controller extends Page_Controller {
public function GetStaticSidebar(){
return DataObject::get_one("StaticSidebar");
}
?>
___________________
StaticSidebar.ss
<% control GetStaticSidebar %>
$SidebarHTML
<% end_control %>
___________________
In my HomePage.ss layout, I call it all this way:
<div id="sidebar">
<% include StaticSidebar %>
</div>
I get no errors. The sidebar just fails to appear in the draft/published page. I'm thinking it's pretty obvious to someone who hasn't looked at this for days.
I'm willing to start over from scratch if I can just get something that will work. I have to do this for another project in a few days, as well. And I'm a bit nervous that it's taking me this long in an effort to save the client time!
Any help is GREATLY appreciated!