Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1227

Re: doctype not found?

From "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Newsgroups comp.lang.php
Subject Re: doctype not found?
Date 2011-04-20 13:00 +0200
Organization http://alvaro.es/
Message-ID <iomeck$s9j$1@dont-email.me> (permalink)
References <ht1tq6dd3jdbtc8v2quqgflr11i62vberc@4ax.com>

Show all headers | View raw


El 20/04/2011 9:17, geoff@invalid.invalid escribió/wrote:
> I find that with IE9 the page is not centred when first visited.
> Moving to another page and then back to index.php it is then centred?!
>
> With the latest Firefox, Opera, Chrome and Safari for Windows the page
> is centred from the start.
>
> Plus, if I do a W3C HTML check I see that the doctype is not known. If
> I remove the php at the top of the file then no errors found, so, what
> is wrong with the php?

PHP is only a tool to do stuff. That stuff can include things like 
sending e-mail, creating thumbnail images or (as in your case) 
generating HTML to be sent to the browser. But the browser doesn't know 
or care about that: all it can see is the final product as it arrives 
through the internet tubes.

What's a DOCTYPE? It's a tag that you can insert at the top of an HTML 
document to tell the browser what HTML version you are using. The 
browser uses that information to pick rules on how to render the page.

What happens if the browser cannot find a DOCTYPE? It assumes that the 
HTML document is a very old one, from the early times of the web where 
DOCTYPEs did not exist yet, and it tries to render the page in the same 
way that browsers from the late 1990s would do.

So, what's your problem? This:


script type='text/javascript' 
src='assets/javascripts/soundmanager2.js'></script>
<script type='text/javascript' 
src='assets/javascripts/jquery-1.5.1.js'></script>
<script type='text/javascript'>
soundManager.debugMode = false;
soundManager.onready(function () {
/*soundManager.createSound('helloWorld', 'assets/audio-new/chord1.mp3');*/
soundManager.createSound('helloWorld', 
'assets/audio-new/welcome-plus6.mp3');
soundManager.play('helloWorld');
});
</script>	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">


There is no DOCTYPE *on top* of the document. Even if there was one, you 
are not generating a valid HTML document. That means that the browser 
cannot follow the well-established rules on how to display a page: it 
needs to guess how to fix your document first. And that's the main 
problem: there're infinity ways to break HTML so there're infinite ways 
to fix it. You cannot predict how the browser will do it.


-- 
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

doctype not found? geoff@invalid.invalid - 2011-04-20 08:17 +0100
  Re: doctype not found? Jerry Stuckle <jstucklex@attglobal.net> - 2011-04-20 05:24 -0400
  Re: doctype not found? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2011-04-20 06:40 -0400
  Re: doctype not found? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-04-20 13:00 +0200
    Re: doctype not found? geoff@invalid.invalid - 2011-04-20 13:20 +0100
      Re: doctype not found? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-04-20 14:28 +0200
        Re: doctype not found? geoff@invalid.invalid - 2011-04-20 15:12 +0100
          Re: doctype not found? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-04-20 18:05 +0200
            Re: doctype not found? geoff@invalid.invalid - 2011-04-20 23:10 +0100
              Re: doctype not found? Jerry Stuckle <jstucklex@attglobal.net> - 2011-04-20 23:48 -0400
                Re: doctype not found? geoff@invalid.invalid - 2011-04-21 06:33 +0100
      Re: doctype not found? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2011-04-20 09:17 -0400
        Re: doctype not found? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2011-04-20 10:49 -0400
          Re: doctype not found? geoff@invalid.invalid - 2011-04-20 16:29 +0100
            Re: doctype not found? "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2011-04-20 12:51 -0400

csiph-web