Miller Adulu Miller Adulu - 20 days ago 6
PHP Question

How to include a php file with bootstrap content in another php file

I am having trouble including a php file with my navigation bar in another php file.

Here's the navigation file:

<?php echo "
<html>
<head>
<nav class = "navbar navbar-default navbar-fixed-top " role = "navigation">
<div class = "container-fluid">

<div class = "navbar-header navbar-right">
<ul class = "nav navbar-nav">
<li><a href = "index.php"> About Me </a></li>
<li><a href = "contact.php"> Contacts </a></li>
<li><a href = "skills.php"> Skills </a></li>
<li><a href = "portfolio.php"> Portfolio </a></li>
<li><a href = "case_studies.php"> Case Studies</a></li>
<li><a href = "resume.php"> Resume </a></li>
<li><a href = "extras.php"> Extras</a></li>
</ul>
</div>
</div>
</nav>
</head>
<script src = "js/bootstrap.min.js"></script>
<script src = "js/jquery.min.js"></script>
</html>
" ?>


I have this line in my index.php file

<?php
include"navigation.php";
?>


I have checked the referencing of the file and all refereces seem ok.

Answer

" should be '

        <?php echo '
        <html>
        <head>
        <nav class = "navbar navbar-default navbar-fixed-top " role = "navigation">
        <div class = "container-fluid">

          <div class = "navbar-header navbar-right">
            <ul class = "nav navbar-nav">
              <li><a href = "index.php"> About Me </a></li>
              <li><a href = "contact.php"> Contacts </a></li>
              <li><a href = "skills.php"> Skills </a></li>
              <li><a href = "portfolio.php"> Portfolio </a></li>
              <li><a href = "case_studies.php"> Case Studies</a></li>
              <li><a href = "resume.php"> Resume </a></li>
              <li><a href = "extras.php"> Extras</a></li>
            </ul>
          </div>
          </div>
        </nav>
        </head>
        <script src = "js/bootstrap.min.js"></script>
        <script src = "js/jquery.min.js"></script>
        </html>
        ';?>

include the file

<?php
include 'navigation.php';
?>
Comments