title: PHP recursive directory menu
body: <p>I think similar questions have been asked before, but I can't quite wrap my head around whether what I want to do is logicaly possible.</p>
  
  <p>I currently use DDSmoothMenu on our intranet to list documents that we have for all staff to access.</p>
  
  <p>Menu structure would be something like:</p>
  
  <pre><code>Documents -&gt; Finance -&gt; Forms -&gt; File 1
                                -&gt; File 2
                                -&gt; File 3
                       -&gt; Informational -&gt; File 1
                                        -&gt; File 2
            -&gt; Insurance -&gt; File 1
                         -&gt; File 2
  </code></pre>
  
  <p>The basic structure of the menu is below:</p>
  
  <pre><code>&lt;ul&gt;
    &lt;li&gt;&lt;a href='#'&gt;Sub Menu Name&lt;/a&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;a href='#'&gt;Menu Item&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href='#'&gt;Menu Item&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href='#'&gt;Menu Item&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href='#'&gt;Menu Item&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I think it would have to involve some kind of multidimensional array and a recursive directory iterator, but I would like to go through each folder and create the HTML layout as above.</p>
  
  <p>I think it may be possible to do the opening tags, but not sure how to then do the closing tags once that directory is all listed.</p>