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

Weird Sidebar Issue


Reply

3 Posts   908 Views

Avatar
TerryMiddleton

27 April 2009 at 9:45pm Community Member, 108 Posts

I have a site that has a max of 3 menu levels

In my sidebar.ss I have the following code which does not work. I"m pulling my hair. I've had my sidebar working perfectly even showing the 3 menu levels and something happened. I did a dev/build and now it's all tweaked.

Here's the weird part. When I click on any menu(1) item the submenu does not show up, but it shows up for another menu(1) item above it.

<ul id="menu">
   <% control Menu(1) %> <!-- Level I -->
    <li class="m$ID"><a href="$Link" target="_self" class="a$ID">$MenuTitle.XML</a>   
         <% if LinkOrCurrent = current %>
            <% control Children %>
               <ul id="smenu">
                   <li class="sm$ID"><a href="$Link" title="Go to the $Title.XML page" class="sa$ID">$MenuTitle</a></li>
               </ul>
            <% end_control %>    
            <% end_if %>   
   </li>            
   <% end_control %>
</ul>

Can you help. This is really strange and I'm going crazy.

Thanks,

Terry

Avatar
TerryMiddleton

27 April 2009 at 10:30pm Community Member, 108 Posts

Okay, I figured it out. Talked about having your *rear* handed to you by a computer. Oh man! What a weekend.

Here's the big deal. You have to close the <li> with a </li> before you go off and start another <ul> or the children.

Maybe I should take computer 101 again in school. I got smacked down. But it now works like a charm and I can get on with life.

Terry

Avatar
briensmith

13 June 2011 at 7:45am Community Member, 1 Post

The CSS is: http:// w ww.stolen-bikes.org/css/non_ie.css

Basically I want the sidebar (blue div), to line up on the side as it is but up flush against the top as you would expect a floated content area with a floated sidebar next to it. If I take out the #sidebar in the css it DOES align right up at the top as I want it to. The minute you as a float:left or width or anything it jumps down to the end of the #masthead div and beginning of the #content div. Im pretty sure I have everything lined up correctly I just cant figure out why this is doing that.
First of all, you're using an incomplete doctype, so browsers are rendering the page in quirks mode, which is a bad thing. You should use a complete doctype (one that includes a URL) to get browsers to render as close to the same as possible. I recommend HTML 4.01 Strict. A doctype is not a magic fix. It is the first step in the process of fixing your page.
Activating the Right Layout Mode Using the Doctype Declaration
Fix Your Site With the Right DOCTYPE!
Choosing a DOCTYPE
Doctype switching
Rendering Mode and Doctype Switching
http://www.w3.org/QA/2002/04/Web-Quality
http://www.w3.org/QA/2002/04/valid-dtd-list.html

2) Actually the stylesheet is http://stolen-bikes.org/css/non_ie2.css

3) <br /> is not valid HTML. It's XHTML. You should remove the " /" from the end of all start tags for elements that are not allowed to have an end tag in HTML, e.g. <meta>, <link>, <img>, and <br>.

4) Check out this article and this demo from it.

5) Don't forget to make sure that the (X)HTML and CSS code you write is valid.

Thanks

[url=http://www.nerdsrus.com.au]Computer Repairs Brisbane[/url]