thejerm Posted March 6, 2005 Posted March 6, 2005 I wanted to add the character set tag to my site in this form ><?xml version="1.0" encoding="iso-8859-1"?> . I was told it goes before the doctype but whenever I place the code there I get this error message Parse error: parse error, unexpected T_STRING in /home/xxxxxx/public_html/index.php on line 1. Is this because I need to add/change a mime type? Yes I know I could use meta tag but someone said this way was better. Quote
TCH-Tim Posted March 6, 2005 Posted March 6, 2005 I wanted to add the character set tag to my site in this form><?xml version="1.0" encoding="iso-8859-1"?> . I was told it goes before the doctype but whenever I place the code there I get this error message Parse error: parse error, unexpected T_STRING in /home/xxxxxx/public_html/index.php on line 1. Is this because I need to add/change a mime type? Yes I know I could use meta tag but someone said this way was better. <{POST_SNAPBACK}> try putting it before the PHP start tag, as in: ><?xml version="1.0" encoding="iso-8859-1"?> <DOCTYPE blah blah> <?php blah blah ?> Quote
borfast Posted March 6, 2005 Posted March 6, 2005 You have to use PHP to output the <?xml stuff, because since PHP has short_open_tags turned on, when it sees a <? it immediately thinks that whatever is in between <? and ?> is PHP code and tries to interpret it that way. So replace the whole <?xml line with the following: ><?php echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?> And it should work without a problem Quote
thejerm Posted March 6, 2005 Author Posted March 6, 2005 (edited) So replace the whole <?xml line with the following: ><?php echo '<?xml version="1.0" encoding="iso-8859-1"?>'; ?> And it should work without a problem <{POST_SNAPBACK}> Thanks Raul you are the man Edited March 6, 2005 by thejerm Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.