embedded php in html to include header (top part of page) into the page

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-05-04T13:14:11Z Indexed on 2010/05/04 13:18 UTC
Read the original article Hit count: 369

Filed under:
|
|

Hi there, I'm trying to put the top of my page (which is all html) in a seperate file so I only need to change things once like the menu bar etc. So I googled some and found a solution on this website as well, but it doesn't work and I don't know why.

So I have a page like article.html and on the top I have this:

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01         
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>

<?php  include("/pages/header.php");   ?> 

<!-- rest of the html code -->

In the header.php I have the html that should be on the top of each page and it starts with:

<?php
/**
 * @author name
 * website header
 */
?>

<!-- html code -->

So what's wrong with this. When I open the page article.html and right click on it to view the source, I can see the php from above calling the header.php file.

Thanks!

© Stack Overflow or respective owner

Related posts about php

Related posts about html