Forum Moderators: coopster

Message Too Old, No Replies

include question

include question

         

Egbert Souse

6:29 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



I am at wit's end with thsi problem.

I want to include a file. "header.inc" in a php page.
I have the <?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<? include "includes/header.inc";?>
I save the file then test the page and get the following error
XML Parsing Error: not well-formed
Location: file:///C:/my_work/mywebs/myweb/mypage.php
<? include "includes/header.inc";?>
--^

While it may not show up correctly on this page, becuase I copied and pasted the error...the ^ is under the space between the? and i
There is also a space between the ; and?
Any idea what I am doing wrong?

patrickrock

8:15 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



why do you have that xml declaration at the top?

try removing that if you don't need it, I think the <?xml is confusing the php processor. Since <? is the way you start php tags.

Egbert Souse

9:00 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



Thanks patrickrock,

I removed the xml declaration. I uploaded the file to my server. It worked fine. I then tried to load the page locally C://blah blah blah and it opened as a text file using notepadusing I.E. Yet coming from the server it worked perfectly in I.E.

I guess that's just M$ for ya.

Thanks for your help. It is really appreciated!

mcibor

9:08 pm on Apr 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would write the first line with php as it might be needed by browser:

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>";?>

then the rest.

Best regards
Michal Cibor

Egbert Souse

10:31 pm on Apr 25, 2005 (gmt 0)

10+ Year Member



Thanks Michal,

I just added it.