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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Individual Sidebar for different Pages

Go to End



Community Member, 10 Posts

19 February 2009 at 10:52pm

Edited: 20/02/2009 12:24am

Hi there,
like here: it try to use different sidebars for different Pages. I followed the example from the link, but unfortunately it´s not quite working. I´m able to choose in my admin-view the page i want to display in the sidebar, but no content is shown on the output-page.

Here is my data i used:


class ContentPage extends Page
	static $db = array();
	static $has_one = array(
		'RightSideBar' => 'Page' 
	function getCMSFields()
		$fields = parent::getCMSFields();
		$fields->addFieldToTab('Root.Content.Main', new TreeDropdownField("RightSideBar", "Rechte Sidebar anzeigen", "SiteTree"), 'Content');
		return $fields; 
class ContentPage_Controller extends Page_Controller {


class RightSideBar extends ContentPage
	static $db = array();
	static $has_one = array();
class RightSideBar_Controller extends ContentPage_Controller



<div id="contentleft" style="width:500px;">
<% control RightSideBar %> 
	<div id="contentright" style="width:178px;">
		test: $Content 
<% end_control %>

Did I forgot something important?

Thank you for your support.

Best Greetings,