[thelist] Embedding PHP in XHTML files

Hans Zaunere zaunere at yahoo.com
Sat May 18 23:13:01 CDT 2002


You'll need to disable PHP's short tags so it doesn't get confused.

ini_set('short_open_tag', '1');

or set it in your php.ini.

Hans Z.
New York PHP
http://nyphp.org

--- David Bindel <dbindel at austin.rr.com> wrote:
> 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 !


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com



More information about the thelist mailing list