tags:

views:

165

answers:

4

My site is all php pages, since it's all database stuff. However, I'm having trouble putting the pages into no quirks mode... I did the regular thing:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

<html xmlns="http://www.w3.org/1999/xhtml"&gt;

and this doesn't work. If I create an html page with the same code, of course it works.

So this leads me to believe that I can only to off quirks mode in html pages? Maybe this is a stupid question, and I don't need to turn off quirks mode in php page?.. Please help, <form> keeps breaking a line, and I've tried multiple fixes, but I'm thinking it has to do with the site being in quirks mode.

+2  A: 

It doesn't matter how the page is rendered, PHP or static. I suspect your issue is in the doctype declaration. Are you sure the php isn't outputting any characters like a line break before the doctype?

Pete Michaud
My web dev toolbar tells me it's in quirks mode. This is the start of the code looks like: <? global $inc; $inc='adfads'; $pth='./'; $pge='login'; include_once("template/header_tmpl.php"); //error_reporting(); if (isset($_GET['start'])) $start=$_GET['start']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="w3.org/1999/xhtml"><head> Does this look right to you?
A: 

Your PHP script may be outputting some Content-Type header that tells the browser the page is some other formatting than the doctype specifies. I'm not sure how the browser is supposed to resolve such a conflict. I'm also not sure how you've got PHP set up to output the Content-Type headers, but if you look in the PHP manual for headers, you'll probably be on the right track. The setting may also be in your web server config.

rmeador
A: 

If you're doing XHTML, shouldn't you have an XML declaration above the doctype?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;

Also, if you're serving XHTML, be sure the content type is text/xml, not text/html. That's a common error. XHTML is XML and must be served as such or most browsers will ignore the declaration and go with quirks mode.

(Better yet, don't use XHTML, use HTML5.)

If that doesn't fix it, I think Pete Michaud must have the right idea. Check with View Source to see what actually got sent to the browser.

T.J. Crowder
A: 

Yes, so apparently I was adding the code to the wrong page. And the page I should have been adding it to had code that was conflicting. So thanks, it works now.. the stupid page break is still there, like to create new line's no matter what css I apply, but atleast the site is standardized now. Thanks everybody!