/    Sign up×
Community /Pin to ProfileBookmark

hi

i recently ran into a problem with the xml declaration in php. as i do use xhtml 1.1 it is required. now, i store my files as .php and there is some php code on top of each file normally.
now, if i add the line:

[code]<?xml version=”1.0″ encoding=”ISO-8859-1″?>[/code]

to the file, i get the error:

[code]Parse error: syntax error, unexpected T_STRING in /home/www/web283/html/php/disclaimer.php on line X[/code]

where X is the line where i added the xml declaration. any ideas why this happens? any help is greatly appreciated

thanks and take care

Erik

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@WebnerdOct 08.2007 — Use Full PHP tags:

<?php

And turn of short_tags in php.ini or .htaccess file

php_flag short_open_tag Off
Copy linkTweet thisAlerts:
@NogDogOct 08.2007 — If you do not have access to turn off short_open_tag, then you can echo out the xml declaration in PHP mode:
[code=php]
<?php
echo "<?xml version='1.0' encoding='ISO-8859-1'?>n";
?>
<!-- rest of document follows... -->
[/code]
×

Success!

Help @ErikTheSick spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...