Page 1 of 1

XHTML PHP Parse error

Posted: Thu Oct 27, 2005 10:22 am
by mangaskahn
Hi, I'm new to the forum and PHP, I am sorry if this question has been asked before or is some stupidly simple fix. My background is mostly with ASP and a little javascript. I've been designing and building web pages for almost 2 years now and have recently switched to a full Linux Host running Apache/PHP/MySQL. :D My problem is now on the new page I am creating, if I add the XML document headers to my PHP pages, they return a parse error (Parse error: syntax error, unexpected T_STRING in file on line 1) If I remove the XML header, the page does not validate as XHTML. Is there any way to include this header and still have the page parse and render properly?

Here is the first half of the code from my PHP file.

Code: Select all

<?xml version="1.0"?>

<!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">

<head>

 <title>PSG Stitchart Etc. LLC</title>

 <meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />

 <link rel="stylesheet" type="text/css"href="./CSS/psglayout.css" />

 <link rel="stylesheet" type="text/css"href="./CSS/psgpresent.css" />

</head>

<body>

<!-- Header -->

<?php include("./includes/header.php") ?>

<!-- end of header -->

<!-- left column -->

<?php include("./includes/lh-col.php") ?>

<!-- end of left column -->

Posted: Thu Oct 27, 2005 10:28 am
by Chris Corbyn
For that error to crop up you must be writing a raw string into the <?php ?> tags somewhere.

Try putting echo in front of it and encluse it in single quotes....

Posted: Thu Oct 27, 2005 12:47 pm
by mangaskahn
Thanks! that did it. I searched the web for hours trying to find an answer to that question. Thank you very much d11wtq!