PDA

View Full Version : XML Prologue Problem


chilipie
12-09-2004, 09:03 PM
This is my 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">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<title>Chili Pie &raquo; Links</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="Description" content="Chili Pie - On web design, development and life. Ollie Craig's blog and portfolio." />
<meta name="Author" content="Ollie Craig" />
<meta name="Copyright" content="2004, Chili Pie" />
<meta name="Revised" content="05/12/04" />
<meta name="Expires" content="never" />

<style type="text/css" media="all">@import "/style.css";</style>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://www.chilipie.co.uk/blog/feed/rss2/" />
<link rel="alternate" type="text/xml" title="RSS .92" href="http://www.chilipie.co.uk/blog/feed/rss/" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="http://www.chilipie.co.uk/blog/feed/atom/" />

</head>

<body>

<div id="holder">

<div id="top"><h1>Chili Pie - On web design, development and life.</h1><a href="/" title="Chili Pie"><img src="/images/logo.gif" alt="Chili Pie" /></a></div>

<div id="nav">

<?php include("http://www.chilipie.co.uk/includes/menu.inc"); ?>

</div>

<div id="column">

<?php include("http://www.chilipie.co.uk/includes/column.inc"); ?>

</div>

<div id="content">
<h2>Links</h2>
<h3>Why?</h3>

<p>If you haven't already guessed, this is a collection of the sites I frequent. My memory isn't exactly brilliant, and as I can't move my Bookmarks to all the other computers I use, I figured this would be an easier way to do it <img src="blog/wp-images/smilies/icon_wink.gif" alt=";)" />. Also, these might be useful for the people that visit this site (small number as it is).</p>

<h3>My Stuff</h3>
<ul>
<li><a href="http://www.chilipie.co.uk/" title="Chili Pie">Chili Pie</a> - My site! I don't know why you'd want to visit it though; especially as you're already here...</li>
<li><a href="http://www.digicheese.tk/" title="DiGi Cheese">DiGi Cheese</a> - Liam's and my collection of pointless comics and pictures. Complete trash, but you'll love it <img src="blog/wp-images/smilies/icon_lol.gif" alt=";)" />!</li>
</ul>

</div>

</div>

<div id="bottom">

<?php include("http://www.chilipie.co.uk/includes/footer.inc"); ?>

</div>

</body>

</html>


Without the prologue it is fine, but with it I am returned this error by the server:

Parse error: parse error, unexpected T_STRING in /home/httpd/vhosts/chilipie.co.uk/httpdocs/links.php on line 1


Thanks, Ollie.

Alex Vincent
12-11-2004, 04:52 AM
I think I've seen this before. It's a PHP configuration problem.

PHP, by default, has short open tags. That means any XML processing instruction goes through the PHP interpreter, including <?php ?>, <?foo ?>, <?xml ?>, etc.

You'll need a .htaccess file there with the following line:

php_value short_open_tag Off

That should fix it, I think.

gsnedders
12-11-2004, 01:38 PM
You could also use <?PHP echo '<?xml version="1.0" encoding="utf-8" ?>'; ?>

Alex Vincent
12-13-2004, 02:59 AM
The big problem I have with that approach is it doesn't really fix the problem. You could have another processing instruction <?foo ?> that you don't want PHP to pick up.

Of course, that's just theory, not meant to apply to the real, practical world :D

cfc
12-13-2004, 05:01 AM
I'm using PHP5 and have no recollection of whether or not this was different in previous versions but you might be able to modify php.ini to change it if you're running your own server.


From php.ini (in PHP5)

; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
; NOTE: Using short tags should be avoided when developing applications or
; libraries that are meant for redistribution, or deployment on PHP
; servers which are not under your control, because short tags may not
; be supported on the target server. For portable, redistributable code,
; be sure not to use short tags.
short_open_tag = Off

gsnedders
12-13-2004, 04:45 PM
I'm pretty certin that that's the same down to PHP 3.