it was only this year I learned that the proper way to nest lists in HTML is
<ul>
<li>Item
<ul><li>Sub-item</li><ul>
</li>
</ul>
and not
<ul>
<li>Item</li>
<ul><li>Sub-item</li></ul>
</ul>
which makes sense and all, but it is making things hard for me because I am trying to write a thing in PHP that generates a table of contents (a list of nested links) from a web page's headings, and I am having a DICKENS of a time. I figured out how to tell it to *start* a nested list, but I am having trouble figuring out how to close the containing </li> tags correctly. Especially in cases where the list goes from, like, <h4> to <h2>. Do I have to, like, nest the LOOPS too?
I do want to figure it out by myself but if anyone has dealt with this particular problem, hints would be welcome!
#html #php #codeing