Posted by william.clarke on 07/19/06 22:10
abracad_1999@yahoo.com wrote:
> Is it possible to serve valid xhtml with php?
>
> xhtml requires the 1st line:
> <?xml version="1.0" encoding="iso-8859-1"?>
> But php interprets the opening <? as a php statement.
>
> If I try to echo this in PHP:
> <?php
> echo '<?xml version="1.0" encoding="iso-8859-1"?>';
> ?>
> The closing ?> of the xhtml bit is interpreted as closing the php.
> Thus:
> '; ?>
> is displayed in the browser.
>
> Any way around this?
There is no requirements to have "<?xml version="1.0"
encoding="iso-8859-1"?> " at the top of an XHTML page, it is required
for XML though. What is required is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
or
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Read the W3C tutorials... http://www.w3schools.com/xhtml/xhtml_dtd.asp
Navigation:
[Reply to this message]
|