title: making bootstrap nav bar dynamic with php
body: <p>I made a website in bootstrap, and now I'm trying to make it more dynamic. The course I'm following to do this is not using a bootstrap. Is this something really obvious that I'm missing? Please can you have a look over my code?</p>
  
  <p>(I don't want to overload this post with code so only showing nav.php and array.php) I have included the nav.php to the header within the <code>&lt;nav&gt;&lt;/nav&gt;</code> and the array.php at the very top.</p>
  
  <p>Any help would be really appreciated -  I am just starting out on my journey so please be gentle talk to me like I don't know a lot because this is true I don't! :-)</p>
  
  <pre><code>//nav.php which I took out of the header
  &lt;a class="navbar-brand" href="index.html"&gt;Harrisons      Hair &amp;amp; Beauty&lt;/a&gt;
  &lt;button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"&gt;
  &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt;
  &lt;/button&gt;
  &lt;div class="collapse navbar-collapse justify-content-end" id="navbarNav"&gt;
  &lt;ul class="navbar-nav"&gt;
  
      &lt;?php 
  
          foreach($navItems as $item){
              echo "&lt;li class=\"nav-item\"&gt;
                    &lt;a class=\"nav-link\"  href=\"$item[slug]\"&gt;$item[title]&lt;/a&gt;
                    &lt;/li&gt;";
          }
  
      ?&gt;
  
  &lt;/ul&gt;
  &lt;/div&gt;
  
  
  // array.php
  &lt;?php
  
      $navItems = [
          [
          slug =&gt; "index.php"
          title =&gt; "Home"
      ],
          [
          slug =&gt; "about.php",
          title =&gt; "About"
      ],
          [
           slug =&gt; "gallery.php",
           title =&gt; "Gallery"
  
      ],
          [
          slug =&gt; "other.php",
          title =&gt; "Other Services"
      ],
          [
          slug =&gt; "contact.php",
          title =&gt; "Find Us"
      ],
          [
          slug =&gt; "test.php",
          title =&gt; "Test Page"
      ]
  ];
  ?&gt;
  </code></pre>