I'm trying to include the XML declaration and the document type description in my PHP pages, but I seem to be having trouble with the question marks in the XML declaration messing up my PHP server. The page is /pages/index.php and it's including /include/dtd.htm. Here are the [relevant] contents of the two files:
/index.php:
Code:
<?php include '../include/dtd.php'; ?>
<html>
<head>
...
/include/dtd.htm:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
This results in the following message:
Code:
Parse error: parse error, unexpected T_STRING in http://www.ayteebee.co.uk/pages/index.php on line 1
Commenting out the ? with a \ works ok, but then it doesn't validate. Here is a list of everything I've tried so far and its result:
1) Commenting out the ? with a \: Parses, but the backslash is left in the source code, so it doesn't validate.
2) Commenting out the entire line with a #: Parses, but again, the hash is left in the source so it doesn't validate.
3) Changing dtd.htm to dtd.php and calling the statements using the echo function: Still won't parse, trying above hacks has the same problems as before.
4) Swapping the <?xml ... ?> and <!DOCTYPE ...> lines around: As 3).
5) Enclosing the ? in single or double quotations: Once again, the quotations are left in the source.
6) I searched the internet and LQ, but didn't seem to find anything, which seems odd, because it can't be an uncommon problem. However I'm not the best webcrawler.
Oh, and I don't have access to the configuration files and stuff (cheap webhost).
So now I'm all out of ideas. How do I include a file without the question mark breaking things?
Thanks in advance.