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, Ed, biapar, Willr, Ingo, swaiba

Menu() in <head>

Go to End



Community Member, 3 Posts

13 August 2009 at 1:00am

I'm trying to use the Menu() function in the <head> section of to determine if I should include a CSS file which is configured for content to take the whole width of the page or leave room for the sidebar. (My reasoning is that I don't want that extra space for the sidebar on the page if there isn't going to be one, and leaving it as auto doesn't work right in Firefox..fine in IE though...) But when I try to put it there, or try to use it in initialization for Page_Controller, pages never load, and I don't get any error messages. My assumption is that the Menu function can't be called that early on in the game.

This is the code I'm trying to use (this is what I tried in Page_Controller.init():
if(Menu(2)) {
} else {

And, this is what I tried in before I tried it that way:
<% if Menu(2) %>
<% require themedCSS("layout-withside") %>
<% else %>
<% require themedCSS("layout-noside") %>
<% end_if %>

If anyone has any has any ideas it would be greatly appreciated. Or any workarounds for the CSS, which I will include below..the files are very basic, it is only to get around the fact that Firefox doesn't seem to think of width:auto; the same as IE does.

#Content {
width: 100%;
float: left;
margin: 0;
text-align: left;

#Content {
width: 540px;
float: left;
margin: 0;
text-align: left;