Forum Moderators: coopster

Message Too Old, No Replies

PHP and specific HTML tags

         

hexdj

9:23 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



I have an HTML document that uses these opening tags


<?xml version="1.0" encoding="UTF-8"?>
<!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" >
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />

If these tags are not in my file it won't show correctly, but whenever I save the HTML as .php and preview it, it gives me the following error:

Parse error: syntax error, unexpected T_STRING in c:\Wamp\www\new_lbo\fixit.php on line 1

Is there any way to work around this?

ChadSEO

9:27 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



hexdj,

One possible solution is to change that first line to:

<? echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";?>

Chad

hexdj

9:32 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



how can I have the " added thru echo? is there a escape character like /" or something like that?

ChadSEO

9:53 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



hexdj,

Yes, to echo a double-quote, escape it using the backslash, like this: \" The example I posted should have that already in there.

Chad

hexdj

10:28 pm on Aug 11, 2005 (gmt 0)

10+ Year Member



That certainly did the trick... thanks a lot ChadSEO