0

I'm using collections to generate a menu of categories. The idea is to have this structure:

<nav class="collapse show navbar navbar-vertical navbar-light align-items-start p-0 border border-top-0 border-bottom-0" id="navbar-vertical">
    <div class="navbar-nav w-100 overflow-hidden" style="height: 350px">
        <a href="" class="nav-item nav-link">Menu A</a>
        <a href="" class="nav-item nav-link">Menu B</a>
        <a href="" class="nav-item nav-link">Menu C</a>
    </div>
</nav>

Using collections, I managed to bring the categories in this way:

<nav class="collapse show navbar navbar-vertical navbar-light align-items-start p-0 border border-top-0 border-bottom-0" id="navbar-vertical">
    <div class="navbar-nav w-100 overflow-hidden" style="height: 350px">
        <?php echo $this->Html->link(collection($json["data"])->combine('id', 'name')->toArray(), '/pages/link', array('class' => 'nav-item nav-link ')); ?>
    </div>
</nav>

The problem is that the menus are not one under the other.

Could you help me with this structure?

E. Biagi
  • 452
  • 3
  • 12
  • To me it seems more like you have css problem instead of a CakePHP problem. Have you tried setting display: block; to your nav-link class? – Steve Kirsch May 16 '23 at 18:57

0 Answers0