# Generate tree menu with Dropdown - Cakephp 3.8

**URL:** <https://discourse.cakephp.org/t/generate-tree-menu-with-dropdown-cakephp-3-8/7902>\
**Category:** Need Help\
**Created:** [June 5, 2020, 12:43am UTC](https://discourse.cakephp.org/t/generate-tree-menu-with-dropdown-cakephp-3-8/7902 "2020-06-05T00:43:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ecei](https://avatars.discourse-cdn.com/v4/letter/e/f08c70/32.png) [@ecei](https://discourse.cakephp.org/u/ecei)\
**Post date:** [June 5, 2020, 12:43am UTC](https://discourse.cakephp.org/t/generate-tree-menu-with-dropdown-cakephp-3-8/7902/1 "2020-06-05T00:43:59Z")

</div>

I created a menu of categories using tree in cakephp3. I can add, edit, display and everything. However, I can’t generate the dropdown menu because I have doubts to manipulate the submenus items (children).

I’m doing it that way

```auto
    public function display()
    {
        $this->viewBuilder()->setLayout('loja');
        $this->loadModel('Categorias');
        $item = $this->Categorias->find('all');
        $this->set('list', $item);
    }

```

And exhibiting like this:

```auto
<div class="md-accordion accordion" id="accordionEx" role="tablist" aria-multiselectable="true">
        <div class="card">
      <div class="card-title blue-gradient" style="height: 40px">
        <p class="card-text white-text mt-2 ml-4">Departamentos</p>
      </div>
            <?php foreach ($list as $categoria): ?>
          <button type="button" class="list-group-item list-group-item-action">
            <?= h($categoria->nome) ? $this->Html->link($categoria->nome, ['controller' => 'Categorias', 'action' => 'buscar_categorias', $categoria->id]) : '' ?>
          </button>
          <?php endforeach; ?>
    </div>

```

But they are like a list, one above the other. I cannot distinguish between submenus. The idea was to organize this as in the image, but the question arises as to how to handle the child items.

![tela](https://canada1.discourse-cdn.com/flex029/uploads/cakephp/original/2X/f/f7952d9082e8f37691f8c2018d939ba359f6d92d.png)

code referring to the image:

```auto
<div class="sidenav">
  <a href="#about">About</a>
  <a href="#services">Services</a>
  <a href="#clients">Clients</a>
  <a href="#contact">Contact</a>
  <button class="dropdown-btn">Dropdown 
    <i class="fa fa-caret-down"></i>
  </button>
  <div class="dropdown-container">
    <a href="#">Link 1</a>
    <a href="#">Link 2</a>
    <a href="#">Link 3</a>
  </div>
  <a href="#contact">Search</a>
</div>

```

Thanks for any comment!
