DOCTYPE prob

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shiningtor
Forum Newbie
Posts: 4
Joined: Fri Sep 21, 2007 11:39 am

DOCTYPE prob

Post by shiningtor »

Hi

I have changed my server to enable webpages with html extensions to use PHP.

How do I display a webpage with this DOCTYPE (see below) because the browser now displays an error for the first line?

<?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" lang="en">

Thanks

Shiningtor
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

Re: DOCTYPE prob

Post by jimthunderbird »

I have similar problem before.

Maybe just use php's print command:

print “<?xml version=”1.0″?>";

instead of write it directly in html

Hope this helps.

-- Jim
deadoralive
Forum Commoner
Posts: 28
Joined: Tue Nov 06, 2007 1:24 pm

Re: DOCTYPE prob

Post by deadoralive »

look in your php.ini file for the short_open_tags setting. Change this to off and you shouldn't have any more problems
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Re: DOCTYPE prob

Post by feyd »

deadoralive wrote:look in your php.ini file for the short_open_tags setting. Change this to off and you shouldn't have any more problems
One's code should be flexible enough to work whether short tags are enabled or not. Therefore printing the statement is better.
shiningtor
Forum Newbie
Posts: 4
Joined: Fri Sep 21, 2007 11:39 am

Re: DOCTYPE prob

Post by shiningtor »

Many thanks for that.

Shiningtor :lol:
Post Reply