包含在bootstrap中

This is how it looks when everything is in one file index.php file

<link href="css/bootstrap.min.css" rel="stylesheet"/>
    <script src="js/bootstrap.min.js"></script>
<div class="head">
    <?php include_once("menu.php"); ?>
</div>

menu.php file

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
   <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" 
         data-target="#menu">
         <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="index.php">Silverado</a>
   </div>
   <div class="collapse navbar-collapse" id="menu">
      <ul class="nav navbar-nav">
         <li><a href="index.php">Home</a></li>
         <li><a href="movies.php">Movies</a></li>
         <li class="active"><a href="price.php">Price List</a></li>
         <li><a href="contact.php">Contact Us</a></li>
      </ul>
   </div>
</nav>

This is my code for displaying menu in webpage using bootstrap. This works fine. But i want to keep this bit of code in different file and include it in my webpage using include_once tag of php. If I put this code in different file and include it in my webpage it doesnt display the menu at all if i run my index.php page. Please help!

Well... The PHP in your index.php should look like this :

include_once ('index.php');

And put the head elements in your index.php.

Be sure PHP is working. Put this somewhere :

<?php echo "PHP is working !"; ?>

Here is what you should have :

index.php

<html>
    <head>
        <link href="css/bootstrap.min.css" rel="stylesheet"/>
        <script src="js/bootstrap.min.js"></script>
    </head>
    <body>
        <?php include_once ("menu.php"); ?>
    </body>
</html>

menu.php :

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
   <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" 
         data-target="#menu">
         <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="index.php">Silverado</a>
   </div>
   <div class="collapse navbar-collapse" id="menu">
      <ul class="nav navbar-nav">
         <li><a href="index.php">Home</a></li>
         <li><a href="movies.php">Movies</a></li>
         <li class="active"><a href="price.php">Price List</a></li>
         <li><a href="contact.php">Contact Us</a></li>
      </ul>
   </div>
</nav>