title: multi-level menu in smarty
body: <p>I have an associative array in PHP.
  Here is the code:</p>
  
  <pre><code>   $result = mysql_query("SELECT * FROM `tb_menu` ORDER BY id ASC");
  $menu = array();
  $menu_index = array();
  while($row = mysql_fetch_assoc($result)){
    if($row['par'] == 0) {
      $menu[] = $row;
      $menu[sizeof($menu)-1]['child'] = array();
      $menu_index[$row['id']] = &amp;$menu[sizeof($menu)-1];
    } else {
      $menu_index[$row['par']]['child'][] = $row;
      $menu_index[$row['id']] = &amp;$menu_index[$row['par']]['child'][sizeof($menu_index[$row['par']]['child'])-1];
    }
  }
  /*print ( '&lt;pre&gt;' )  ;
          print_r ( $menu ) ; 
          print ( '&lt;/pre&gt;' ) ; exit();*/
  $smarty-&gt;assign('menu', $menu);
  </code></pre>
  
  <p>I can't make it work on smarty, cause I am a beginner in it.
  Please help me make multi-level menu like this</p>
  
  <pre><code>&lt;ul&gt;
  &lt;li&gt;&lt;a href=""&gt;first level&lt;/a&gt;
      &lt;ul&gt;
          &lt;li&gt;&lt;a href=""&gt;second level&lt;/a&gt;&lt;/li&gt;
            ......................................
              &lt;ul&gt;
                    &lt;li&gt;&lt;a href=""&gt;N-level&lt;/a&gt;&lt;/li&gt;
              &lt;ul&gt;
      &lt;/ul&gt;
  &lt;/li&gt;
  &lt;/ul&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Thanks</p>