Forum Moderators: coopster

Message Too Old, No Replies

w3c validation of php pages...

         

Rich

1:58 am on Mar 5, 2004 (gmt 0)

10+ Year Member



G'day Peoples,
I am currently attempting to validate a php page through w3c, I keep getting the same error:

# Line 59, column 45: "DOCTYPE" declaration not allowed in instance

...rsion="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1
^

# Line 60, column 42: document type does not allow element "html" here (explain...).

<html xmlns="http://www.w3.org/1999/xhtml">

I have discovered the reason is that when I save my file with the php code and run it on my server it always inserts:

<?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">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
</body>
</html>

Where my code sits in the source file.

Can anyone tell me of a means to avoid this occuring?

Cheers

Timotheos

4:18 pm on Mar 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



when I save my file with the php code and run it on my server it always inserts

What program are you using?

Rich

11:10 pm on Mar 5, 2004 (gmt 0)

10+ Year Member



Dreamweaver MX...

Timotheos

12:54 am on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe this thread will help.

[webmasterworld.com...]

Rich

11:01 pm on Mar 6, 2004 (gmt 0)

10+ Year Member



OK...that explains allot but I already have DW set that way.

The problem in this case is not actually DW, DW saves the code exactly as I want it to (except when using templates, which I have decided not to use for php pages).

The problem is when the code is processed by my web server. It seems to be the web server that is inserting the superfluous code after processing the page.

Timotheos

7:33 pm on Mar 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So you're saying if you ftp to your site and view the file that it does not have <?xml version="1.0" encoding="iso-8859-1"?> at the top.

But if you serve it up in a web browser then it does have <?xml version="1.0" encoding="iso-8859-1"?>?

Rich

11:42 pm on Mar 8, 2004 (gmt 0)

10+ Year Member



That's correct...
The thing is that it does not insert the code at the top of the page it inserts down around the middle of the page were my php code sits in the source file...

Timotheos

12:44 am on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm... I don't use DreamWeaver so I can't comment on that but I'm still suspicious that DW is doing the inserting. Hopefully somebody else can help.

BTW, what type of server is it?

Rich

2:22 am on Mar 9, 2004 (gmt 0)

10+ Year Member



It is an apache server runnin php 4 and mysql...

Timotheos

10:53 pm on Mar 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Possibly something in htaccess then?

Rich

11:37 pm on Mar 9, 2004 (gmt 0)

10+ Year Member



htaccess?

Timotheos

7:03 am on Mar 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry. Bum steer. I found out you can force the MIME type in htaccess but it doesn't actually put a xml tag in your page.

If it truly is a server issue then you need to talk to your web host about it.