Forum Moderators: coopster

Message Too Old, No Replies

How do I add a <? to PHP page? HTML - <?xml

         

nitsuj

3:22 pm on Oct 15, 2006 (gmt 0)

10+ Year Member



I have a really odd problem. I am trying to change my site from asp to php. but have encountered a problem
The start of my pages have always been:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

My problem is when I add <?xml ... the php parser kicks in and starts complaining.
If I leave the <?xml version="1.0" encoding="iso-8859-1"?> Off the page is displayed but not correctly in IE!

Questions:
1) How can I make php let me add the: <?xml version="1.0" encoding="iso-8859-1"?>

2) Thinking about is I'm not 100% sure why I originally added the <?xml version="1.0" encoding="iso-8859-1"?> (I made the site over a year ago) - does anyone know why it is needed for the page to display correctly in IE?

Thanks loads

ahmedtheking

8:24 pm on Oct 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use this:

<?php

echo '
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> ';

?>

barns101

8:37 pm on Oct 15, 2006 (gmt 0)

10+ Year Member



Alternatively, turning short tags off in php.ini should resolve the problem.

nitsuj

5:18 am on Oct 16, 2006 (gmt 0)

10+ Year Member



Thanks loads for your help!

nitsuj

7:29 am on Oct 16, 2006 (gmt 0)

10+ Year Member



Does anyone kow which forum I can ask my 2nd question in?

2. Thinking about is I'm not 100% sure why I originally added the <?xml version="1.0" encoding="iso-8859-1"?> (I made the site over a year ago) - does anyone know why it is needed for the page to display correctly in IE?

ahmedtheking

7:44 am on Oct 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No idea why you need it, it probably doesn't make a difference now! I use DTD XHTML 1.1:

[w3.org...]

whoisgregg

3:44 pm on Oct 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was going to recommend the HTML and browser forum [webmasterworld.com] for your 2nd question, but it looks like you already found it [webmasterworld.com]. :)