[thelist] Embedding PHP in XHTML files
David Bindel
thelist at lists.evolt.org
Sat May 18 22:36:01 2002
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