title: CakePHP 3 create dynamic Menu
body: <p>I am trying to create a short submenu for CakePHP with a Database Table.</p>
  
  <p>First I tried this solution <a href="https://stackoverflow.com/questions/8386031/how-to-create-dynamic-navigation-menu-cakephp">how to create dynamic navigation menu cakephp</a> which seemed outdated (because its two years old) and since I don´d need to add menus over the add function, its to big anyways.</p>
  
  <p>So can I solve this with just the table in my DB, the model in Cake and an element?</p>
  
  <p>Thats what I got so far:</p>
  
  <p><strong>src/template/element/main.ctp</strong></p>
  
  <pre><code>&lt;ul class="header main-menu"&gt;
      foreach($something as $something ) :
          ?&gt;
          &lt;li&gt;
   somethine
          &lt;/li&gt;
      &lt;? endforeach; ?&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>my view</strong></p>
  
  <pre><code>&lt;?= $this-&gt;element('main'); ?&gt;
  </code></pre>
  
  <p><strong>My Model</strong></p>
  
  <pre><code>class Menu extends Entity
  {
  
      var $name = 'Menu';
  
  }
  </code></pre>
  
  <p>Is this the way to go?</p>