Jump to content

xml on php question...


eaglelegend

Recommended Posts

here is my header.php file, just above the header, includes the header info...

 

<?php
session_start();
include("config.php");
?>

       <?xml version="1.1"?>
       <!DOCTYPE html PUBLIC "-//W3C//DTD DTD XHTML plus Math 1.1//EN" "http://www.w3.org/TR/2001/REC-MathML2-20010221/dtd/xhtml-math11-f.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" />
   <meta name="description" content="description" />
   <meta name="keywords" content="keywords" />
<title>title</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
</head>

 

now up the top, where the start of <?xml etc. is, it gives me the parse error, as the following states...

 

Parse error: syntax error, unexpected T_STRING in URL/header.php on line 6

 

Does anyone know why this is doing this? any help is helpful thanks!

Link to comment
https://forums.phpfreaks.com/topic/107908-xml-on-php-question/
Share on other sites

thats the point :/. im trying to change it from html to xhtml!

 

this is the updated code btw, not that much differant but well...

 

<?php
session_start();
include("config.php");
?>
<?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" />
   <meta name="description" content="description" />
   <meta name="keywords" content="keywords" />
<title>title</title>
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="shortcut icon" href="favicon.ico" />
</head>

Link to comment
https://forums.phpfreaks.com/topic/107908-xml-on-php-question/#findComment-553153
Share on other sites

xhtml is basically html.

 

one main difference is that ALL tags must be closed, and attributes MUST be lower case, along with tag names. It is the most strict format of all the HTML/XHTML families.

 

so, just remove this line:

<?xml version="1.0" encoding="UTF-8"?>

 

and it should work.

Link to comment
https://forums.phpfreaks.com/topic/107908-xml-on-php-question/#findComment-553157
Share on other sites

That line is acceptable, although I've seen arguments for and against using it. It can cause quirks mode to be enacted in IE which is why I don't use it, although there are other reasons to use it.

 

To the OP - if you are determined to keep that line, then keep it inside your php tags, and echo it out. This will prevent PHP from trying to parse it as PHP.

Link to comment
https://forums.phpfreaks.com/topic/107908-xml-on-php-question/#findComment-553180
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.