When displaying nested lists, they are created like this:
<ul>
<li class="expanded"><a href="/taxonomy/term/3">Internet Services</a></li>
<ul>
<li class="collapsed"><a href="/taxonomy/term/1">Web Sites</a></li>
</ul>
</ul>
...
HOWEVER, they should be created like this:
<ul>
<li class="expanded"><a href="/taxonomy/term/3">Internet Services</a>
<ul>
<li class="collapsed"><a href="/taxonomy/term/1">Web Sites</a></li>
</ul>
</li>
</ul>
...
Specifically, you cannot nest a UL directly within another UL. It MUST be contained within an
first.
Comments
Comment #1
kbahey commentedDo you have a reference from W3C or elsewhere that it should be the way you mentioned?
Before fixing it, I just want to make sure that this is in conformance to standards.
Thanks.
Comment #2
tangent commentedThe W3C definition for lists states that the ONLY element that may be placed in a UL element is an LI element. This isn't stated very clearly though and you must look at the DTD to determine this.
http://www.w3.org/TR/REC-html40/struct/lists.html#edef-UL
You can also validate the page output using the HTML validator.
http://validator.w3.org/
Comment #3
kbahey commentedYeah, I see the problem now. However with the code as it is now, it is hard to modify it.
Patches welcome though.
Comment #4
moshe weitzman commentedi don't know if the dhtml script which powers taxonomy_dhtml understands the desired nesting. I remember struggling with this before.
Comment #5
Méléis commentedHere is the diff i've just done :
The patch works for me but i've got a quite simple list to generate. There is just one level... so i haven't tested it on other ones. You can see a working version here : http://www.meleis.yi.org/plan-du-site/.
It's not a perfect patch i've just done something that works. I have to admit i really don't care about PHP code as long as HTML code is clean.
As it is a
theme_sitemenu_render_outline($tree)if you are using PHP based themes you can create a function namednameofyourtheme_sitemenu_render_outline($tree)without having to change the original file.Complete file is attached to this post.
Have fun :o).
Comment #6
Méléis commentedI've forgotten to say : if you have an empty taxonomy it generates an only "
". So of course it's not valid.
If you want my opinion the loop mustn't be done while there is nothing to show (you have to test it before launching the loop).
Anyway it's not a problem at all because an empty list is just useless. You can desactivate the empty taxonomy in sitemenu properties and you can also fill it :o).
Comment #7
Méléis commentedSorry : "I've forgotten to say : if you have an empty taxonomy it generates an only
</ul>. So of course it's not valid."Comment #8
kbahey commentedThanks to Meleis for the fix. It is now commited.
Comment #9
(not verified) commentedComment #10
(not verified) commented