0

Hi there,

I have a webpage in HTML, strong-links.org, and am tired of having to make changes to every single page when I update the header or footer, and someone suggested I can use PHP to reference the template within the HTML pages.

As a test, I have test.strong-links.org/index2.html live with the following code:

<html>    

    <head>

            <title>Strong Links</title>

    </head>

    <body>

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

    </body>

</html>

And header.php in the same location with the following code:

`

<div id="navigation">

    <ul>

        <li><a href="">Home</a></li>

        <li><a href="">Test1</a></li>

        <li><a href="">About</a></li>

        <li><a href="">Contact</a></li>

    </ul>

</div>

`
I am using Apache with PHP5.

Can anyone tell me why this is not working?

4
Contributors
5
Replies
35
Views
2 Years
Discussion Span
Last Post by James_43
1

It should work if the header.php file is in the same directory as the files where you place the include statement.

In addition ensure that all files with this include statement have the .php extension.

Do you get any errors?

BTW - you don't need the brackets.

Edited by diafol

0

If the problem solved by @diafol's suggestion, please mark this thread as solved. If it is not, try to confirm if the hosting support php as I previously face issue where a hosting do not provide it.

0

index2.html should be named index2.php . The PHP interpreter won't be used (by default, anyway) if the extension is html.

0

Hey guys,

So so sorry for the delay in response - been out of service for the last two weeks.

madCoder your suggestion worked :) I renamed it to .php and the header popualted fine! Thanks so much!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.