FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » doctype not found?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: doctype not found? [message #173606 is a reply to message #173599] Wed, 20 April 2011 11:00 Go to previous messageGo to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma:
Senior Member
El 20/04/2011 9:17, geoff(at)invalid(dot)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
--
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Parameter passing question
Next Topic: My contact form is not emailed to me
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 04:27:53 GMT 2024

Total time taken to generate the page: 0.04029 seconds