PHP Classes

Is the HTML right?

Recommend this page to a friend!

      Walker  >  All threads  >  Is the HTML right?  >  (Un) Subscribe thread alerts  
Subject:Is the HTML right?
Summary:I don't think the nested list is being coded quite right
Messages:1
Author:michael andersen
Date:2011-02-02 23:29:38
 

  1. Is the HTML right?   Reply   Report abuse  
Picture of michael andersen michael andersen - 2011-02-02 23:29:38
Hi there

This promises to be a very useful bit of code!

Perhaps I should be calling your class a different way?

Rather than closing a parent's <li> with an </li> how can one inject the children's <ul> and <li> into the parent's own <li>?

I'm a bit confused about the HTML that is produced by the demo...

As is, the test.php yields;
<ul>
<li>Cat 6</li>
<li>
<ul>
<li>Cat 1</li>
<li>
<ul>
<li>Cat 2</li>
<li>Cat 3</li>
<li>
<ul>
<li>Cat 4</li>
</ul>
</li>
</ul>
</li>
<li>Cat 8</li>
</ul>
</li>

----snip----

But as I understand how nested lists work, should you not be producing HTML like the following?


<ul>
<li>Cat 6
<ul>
<li>Cat 1
<ul>
<li>Cat 2</li>
<li>Cat 3
<ul>
<li>Cat 4</li>
</ul>
</li>
</ul>
</li>
<li>Cat 8</li>
</ul>
</li>

---------------------------------

Maby I'm missing something here in how to use this class?

Michael