21490 Posts in 5783 Topics by 2622 members
General Questions
SilverStripe Forums » General Questions » [solved]can't get $sidebar to display in sidebar.ss, but it works in page.ss..
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 921 Views |
-
[solved]can't get $sidebar to display in sidebar.ss, but it works in page.ss..

22 January 2009 at 8:41pm Last edited: 22 January 2009 11:37pm
hey all,
having an odd problem with my silverstripe 2.2.3 install trying to get the sidebar displayed in sidebar.ss
I've configured my page.php as instructed in the widgets tutorial, but if I add $Sidebar to sidebar.ss 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..
<?php
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() {
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}
}?>
and my sidebar.ss is also super basic, having only added the $Sidebar function to it.
<div id="Sidebar" class="typography">
$Sidebar
<div class="sidebarBox">
<h3>
<% control Level(1) %>
$Title
<% end_control %>
</h3>
<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">
<li>
<ul>
<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 %>
</span>
</ul>
</li>
</ul>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
</ul><div class="clear"></div>
</div><div class="sidebarBottom"></div>
$Sidebar</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!
----edit-----
found the problem with some irc aid, ended up being the theme/template/layout/page.ss file.
there's an if statement that hides $sidebar if there are no child pages. so removing that fixed the thing. thank guise.
| 921 Views | ||
|
Page:
1
|
Go to Top |

