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

[solved]can't get $sidebar to display in, but it works in

Go to End



Community Member, 3 Posts

22 January 2009 at 8:41pm

Edited: 22/01/2009 11:37pm

hey all,

having an odd problem with my silverstripe 2.2.3 install trying to get the sidebar displayed in

I've configured my page.php as instructed in the widgets tutorial, but if I add $Sidebar to it refuses to display on the site.

I've tried db/build and ?flush-ing the mainpage, but nothing seems to work.

my page.php is standard..


class Page extends SiteTree {
	static $db = array(
	static $has_one = array(
	"Sidebar" => "WidgetArea",

function getCMSFields() {
	$fields = parent::getCMSFields();
	$fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("Sidebar"));
	return $fields;

class Page_Controller extends ContentController {
	function init() {


and my is also super basic, having only added the $Sidebar function to it.

<div id="Sidebar" class="typography">
	<div class="sidebarBox">
			<% control Level(1) %>
			<% end_control %>
  		<ul id="Menu2">
		  	<% control Menu(2) %>
  	    		<% if Children %>
			  	    <li class="$LinkingMode"><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
	  	    	<% else %>
		  			<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levela"><span><em>$MenuTitle</em></span></a>
				<% end_if %>	  
	  			<% if LinkOrSection = section %>
	  				<% if Children %>
						<ul class="sub">
								 	<span class="roundWhite">
								  	<% control Children %>
						  	  			<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levelb"><span><em>$MenuTitle</em></span></a></li>
 				 					<% end_control %>
			 		 <% end_if %>
				<% end_if %> 
  			<% end_control %>

		<div class="clear"></div>

	<div class="sidebarBottom"></div>


any help would be appreciated, since I feel like I'm banging my head against a wall here..

I'm running the install locally using vhosts, if that changes anything.

thanks a lot!


found the problem with some irc aid, ended up being the theme/template/layout/ file.
there's an if statement that hides $sidebar if there are no child pages. so removing that fixed the thing. thank guise.