XHTML PHP Parse error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mangaskahn
Forum Newbie
Posts: 2
Joined: Thu Oct 27, 2005 9:25 am

XHTML PHP Parse error

Post 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 -->
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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....
mangaskahn
Forum Newbie
Posts: 2
Joined: Thu Oct 27, 2005 9:25 am

Post 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!
Post Reply