Jump to content

Recommended Posts

Posted

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.
Posted
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.

 

try putting it before the PHP start tag, as in:

><?xml version="1.0" encoding="iso-8859-1"?>
<DOCTYPE blah blah>

<?php
blah blah
?>

Posted

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 :shocking:

Posted (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 :)

 

 

 

Thanks Raul you are the man :oops:

Edited by thejerm

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...