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?

Member Avatar for diafol

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.

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.

Member Avatar for diafol

Heh heh. 6 days now lps. Some members have the decency to respond, some don't :)

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

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.