Bootstrap navigation include

912 Views Asked by At

I have the following bootstrap navbar. I want to include nav.php into all of my php pages. Well I have done simple includes in the past but with div tags something tells me I am doing this wrong.

<nav class="navbar navbar-fixed-top navbar-inverse">
          <div class="container-fluid">
          <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
               <span class="sr-only">Toggle navigation</span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
               <span class="icon-bar"></span>
           </button>
               <a class="navbar-brand" href="#"><img src="assets/img/logo.png" alt=" "></a> 
           </div>

           <!-- Collect the nav links, forms, and other content for toggling -->
           <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
              <?php include 'nav.php';?>                
        </div><!-- /.navbar-collapse -->
   </div><!-- /.container-fluid -->
 </nav>

My nav.php is as following

               echo'
               <ul class="nav navbar-nav navbar-right">
               <li><a href="index.html">HOME</a></li>
               <li><a href="itsupport.html">TEAM</a></li>
               <li class="dropdown">
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">SERVICES <span class="caret"></span></a>
               <ul class="dropdown-menu" role="menu">
                 <li><a href="itservices.html">IT SERVICES</a></li>
                 <li><a href="voiceservices.html">VOICE SERVICES</a></li>
                 </li>
                 </ul>
                </li>
                      <li><a href="careers.html">CAREERS</a></li>
                      <li><a href="careers.html">INTERESTING INFORMATION</a></li>
                      <li><a href="contact.html">CONTACT</a></li>
                      </ul>';
1

There are 1 best solutions below

0
On

Two possible paths:

Add <?php tag to your nav.php file, or remove echo statement and make the file plain HTML.