Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.