What is the best way to convert a doctrine nested set to an li-structure?

Posted by murze on Stack Overflow See other posts from Stack Overflow or by murze
Published on 2010-05-05T09:41:45Z Indexed on 2010/05/05 9:48 UTC
Read the original article Hit count: 233

Filed under:
|
|
|
|

Hi,

I'm using Doctrine NestedSet behavior. I'd like to render the tree using php to <ul>'s and <li>'s

Here's an example of what the output might be:

<ul>
  <li>Node 1</li>
  <li>Node 2
       <ul>
         <li>Child 1 of Node 2</li>
         <li>Child 2 of Node 2
              <ul>
                 <li>Another Child</li>
                 <li>Yet Another Child</li>
              </ul>
         </li>
       </ul>
     </li>
   <li>Node 3</li>
</ul>

What is the best way to do this?

© Stack Overflow or respective owner

Related posts about php

Related posts about doctrine