Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Reply to Thread

Post a reply to the thread: Are there errors in this small php code?

Your Message

Click here to log in

What is the sum of 36 and 12

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 01-14-2013, 02:45 PM
    sunrise

    Are there errors in this small php code?

    This is my first attempt at using an includes file (for my nagivation bar). Using instructions, I have this piece of code, which isn't working:

    <?php
    require($public_html . includes/nav.html);
    ?>;

    I created an includes folder in my root directory and uploaded the file I created called nav.html
    It has my navigation bar in it and only that. I have checked with my host and the root directory is def public_html

    Here is the instruction on the website I am using:

    1.Save the HTML for the common elements of your site to separate files. For example, your navigation section might be saved as navigation.html or navigation.php.
    2.Use the following PHP code to include that HTML in each page.
    <?php
    require($DOCUMENT_ROOT . "path to file/include-file.html");
    ?>;
    3.Use that same code on every page that you want to include the file.

    Any suggests? thanks
    thanks for both answers I have corrected this but still not working, so perhaps there is a trick to the nav.html file? This is what it looks like, it is simple and just in a table:

    <html>
    <head>
    <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
    </head>
    <body>
    <table style="background-color: rgb(204, 255, 255); width: 971px; height: 32px; text-align: left; margin-left: auto; margin-right: auto;"

    border="0" cellpadding="2" cellspacing="2">
    <tbody>
    <tr>
    <td style="font-family: Helvetica,Arial,sans-serif; text-align: center; color: black; background-color: rgb(0, 0, 153);">
    <a href="index.html"><small><font color="#ffffff">Home</font></small></a></td>
    <td style="font-family: Helvetica,Arial,sans-serif; text-
    It didn't all copy here but you see what is in it. I think the web editor added extra stuff when I opened the file and viewed it. I thought I just copied the table into the file. As in I want to insert just the table, not all this <body> <head> and meta stuff

Posting Permissions

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