[thelist] Embedding PHP in XHTML files

Ward_Conant at URSCorp.com Ward_Conant at URSCorp.com
Mon May 20 13:20:10 CDT 2002


Another option is to simply omit the line ...

<?xml version="1.0" encoding="iso-8859-1" ?>

... completely (it's not *required* by the specification,
and it causes problems with IE, also).



Ward Conant
Solution Design and Production, IT Services
URS - Oak Ridge, TN
tel 865.220.8154
fax 865.483.9061







"David Bindel" <dbindel at austin.rr.com>
Sent by: thelist-admin at lists.evolt.org
05/18/2002 11:32 PM
Please respond to thelist


        To:     <thelist at lists.evolt.org>
        cc:
        Subject:        [thelist] Embedding PHP in XHTML files


I'm just now learning PHP, but I'm having a problem on something that
should
be really simple.

Here's my file, test.php:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
...
</head>
<body>
<p><?php echo("This is a test"); ?></p>
</body>
</html>

Apparently, the XML declaration on the first line (<?xml version="1.0"
encoding="iso-8859-1" ?>) is messing PHP up:

Parse error: parse error, unexpected T_STRING in
c:\inetpub\wwwroot\test.php
on line 1

When I remove the XML declaration on the first line, the PHP works fine,
but
I also throw out my XHTML 1.1 compliance with it.

Surely someone has run into this problem before and knows how to fix it.

Thanks in advance,
David Bindel

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !







More information about the thelist mailing list