eaglelegend Posted May 30, 2008 Share Posted May 30, 2008 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 More sharing options...
The Little Guy Posted May 30, 2008 Share Posted May 30, 2008 because you have it in a file with an extension of .php so it thinks that is an opening PHP tag. Link to comment https://forums.phpfreaks.com/topic/107908-xml-on-php-question/#findComment-553148 Share on other sites More sharing options...
eaglelegend Posted May 30, 2008 Author Share Posted May 30, 2008 so what could I possibly do about this then?.. :-\ Link to comment https://forums.phpfreaks.com/topic/107908-xml-on-php-question/#findComment-553149 Share on other sites More sharing options...
The Little Guy Posted May 30, 2008 Share Posted May 30, 2008 place the XML in an XML file. You can not have XML in a PHP file. that doesn't even look like XML, it looks like HTML. So, you could just remove that line altogether. Link to comment https://forums.phpfreaks.com/topic/107908-xml-on-php-question/#findComment-553150 Share on other sites More sharing options...
eaglelegend Posted May 30, 2008 Author Share Posted May 30, 2008 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 More sharing options...
The Little Guy Posted May 30, 2008 Share Posted May 30, 2008 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 More sharing options...
haku Posted May 30, 2008 Share Posted May 30, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.