Jump to content

Need help with includes


mikevarela

Recommended Posts

For the life of me, I can't get this to work. I'm a little new too.

 

Want to create a standard set of nav links for the whole site, so I'm trying to do it as an include.

Here's what i have so far

----

 

<body>

<div class="wrapper">

<div class="header">

<div class="logo">

  <h1 class="logo">Nuance<span class="logo-light">Tone</span></h1>

</div>

 

<?php include ('navigation.php') ;?>

 

</div>

<div class="middle-left">

  <h2>Boutique Audio Post</h2>

  <p>NuanceTon.........

 

-----

 

then in the include file - which is named navigation.php in the root directory

 

 

 

<html>

<body>

<div class="navigation">

<ul>

    <li><a href="index.php">home</a> </li>

    <li><a href="contact.php">contact</a> </li>

    <li><a href="audiopost.php">audio post</a> </li>

    <li><a href="vo.php">vo</a> </li>

    <li><a href="dj.php">dj</a> </li>

    <li><a href="reel.php">reel</a></li>

  </ul>

  </div>

</body>

</html>

 

-------

 

any help with how to make this work. I keep getting this error.

 

 

Warning: include(navigation.php): failed to open stream: No such file or directory in /- on line 16 Warning: include(): Failed opening 'navigation.php' for inclusion (include_path='.:') in /- on line 16

Link to comment
https://forums.phpfreaks.com/topic/146551-need-help-with-includes/
Share on other sites

also, your include file should just contain a snippet of code (aka get rid of the html & body tags), otherwise the final code would look like:

<body>
<div class="wrapper">
<div class="header">
<div class="logo">
  <h1 class="logo">Nuance<span class="logo-light">Tone</span></h1>
</div>

<html>
<body>
<div class="navigation">
<ul>
    <li><a href="index.php">home</a> </li>
    <li><a href="contact.php">contact</a> </li>
    <li><a href="audiopost.php">audio post</a> </li>
    <li><a href="vo.php">vo</a> </li>
    <li><a href="dj.php">dj</a> </li>
    <li><a href="reel.php">reel</a></li>
  </ul>
  </div>
</body>
</html>

</div>
<div class="middle-left">
  <h2>Boutique Audio Post</h2>
  <p>NuanceTon.........

 

which is no good

Thanks for the help guys, I actually thought about not including the HTML and BODY tags in the include file, so I've deleted them, leaving just the UL. I returned the opening and closing DIV tags for the navigation spot int he index file, just leaving the include () inside, linking to the include file.

 

Still won't work, can't figure it out.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.