Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Themes /

Discuss SilverStripe Themes.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

New Page Type w/ Edittable Sidebar in CMS


Go to End
Reply


2 Posts   1054 Views

Avatar
Dolza

Community Member, 10 Posts

14 January 2010 at 6:40pm

I have everything in here working except displaying the contents of the sidebar itself, i think i am missing some basic functionality of how the variables are passed.

My Page:

<?php

class PageWSidebar extends SiteTree {
	
	public static $db = array("SideBar" => "HTMLText"
	);
	
	public static $has_one = array("SideBar" => "HTMLText"
	);

  function getCMSFields() {
   $fields = parent::getCMSFields();
    $fields->addFieldToTab('Root.Content.Main', new HTMLEditorField ('SideBar', 'SideBar Content'));
 return $fields;
   }
	
}

class PageWSidebar_Controller extends ContentController {
	
	public function init() {
		parent::init();

		Requirements::themedCSS("layout"); 
		Requirements::themedCSS("typography"); 
		Requirements::themedCSS("form"); 
	}

}

?>

and in my Theme I just have

<div class="foo"> $SideBar </div>

there's no errors, it just doesn't show anything that i type into the field in the cms

Avatar
Dolza

Community Member, 10 Posts

15 January 2010 at 9:50am

I had to make it's parent Page, not the tree, so problem solved.