PDA

View Full Version : need help with php include



luckystars62
04-11-2007, 03:06 PM
I'm trying to use the php include for my header, etc on a new site and I'm getting this error message....



Fatal error: Cannot redeclare header() in /home/pnyejnk/public_html/lowcarbjourney/header.php on line 31


What am I doing wrong?
the site is www.lowcarbjourney.com (http://www.lowcarbjourney.com/) and I'm just getting it started. There's not much there yet so I was going to do the php includes for the header, menu bar, left bar and right bar.

I thought I followed the instructions by the letter, but obviously not......

The header is saved on page "header.php"
I'm trying it on a page named "myths.php"

(Sorry.......I posted this in the Tips and Tricks forum by accident already and then realized it didn't belong there. Can someone delete that post since it was in the wrong forum?)

Watdaflip
04-11-2007, 04:17 PM
Will you post lines like 28-35

luckystars62
04-11-2007, 04:34 PM
Not sure how to do that...
I did a view source on the published header page and it just shows the same error message as I posted above.

Watdaflip
04-11-2007, 06:24 PM
The actual php code isn't show in the source. Open the file and copy and paste the php code

luckystars62
04-11-2007, 06:36 PM
Okay.......pasting in the whole code from the page html on the header.php page. The blue text is the php code that was added per instructions from the tips/tricks forum.



<? function header() { ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Untitled Page</TITLE>
<META name="GENERATOR" content="Created by BlueVoda">
<STYLE type="text/css">
div#container
{
width: 1025px;
position: relative;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
body
{
text-align: center;
margin: 0;
}
</STYLE>
</HEAD>
<BODY bgcolor="#FFFFFF" text="#000000">
<DIV id="container">
<IMG src="lcjheader3.jpg" alt="" align="top" border="0" width="895" height="105" style="position:absolute;left:0px;top:0px;width:895px;hei ght:105px;z-index:0">
</DIV>
</BODY>
</HTML><?
}
?>

navaldesign
04-11-2007, 09:01 PM
Rename your "header.php" in "header1.php" or "myheader.php"or something like that. Change the code in the html box accordingly.

Please have a look at your other thread. You have the same answer there.

luckystars62
04-12-2007, 03:25 AM
Yes! That did it! Thanks!!