www.webdeveloper.com
Results 1 to 2 of 2

Thread: PHP include() error with menu file

  1. #1
    Join Date
    Jun 2007
    Posts
    1

    PHP include() error with menu file

    I'm trying to include a navigation menu into my website using PHP. I have two files, test.html and menu.php

    The code for test.html is simply:

    HTML Code:
    <html>
    <body>
        <?php include ("menu.php"); ?>
    <body>
    </html>
    while the code for menu.php is:

    Code:
    <?php
       <a id="navLink" href="aboutus.html"> About Us </a>
    ?>
    When I open test.html in Internet Exlporer, the link is not displaying. I've tried including the complete path in the include() call, and also trying echo in front of the link link in the php file. Nothing I can think of works. Can anyone tell me what I'm doing wrong?

  2. #2
    Join Date
    Jan 2005
    Location
    USA
    Posts
    352
    You can't use php scripting in a .html file.

    Rename the file to test.php.

    I think you need a refresher in PHP as well.

    Your menu.php doesn't need <?php ?> at all...you're just using basic html there...it will give you parse errors if you do that.

    Hope that kinda helped.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles