doctype not found? [message #173599] |
Wed, 20 April 2011 07:17 |
geoff
Messages: 8 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
Hello
Using
http://www.micro-active.com
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?
Thanks
Geoff
|
|
|
Re: doctype not found? [message #173602 is a reply to message #173599] |
Wed, 20 April 2011 09:24 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/20/2011 3:17 AM, geoff(at)invalid(dot)invalid wrote:
> Hello
>
> Using
>
> http://www.micro-active.com
>
> 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?
>
> Thanks
>
> Geoff
>
There is nothing wrong with the PHP - PHP is server-side, and the client
knows nothing about it. It's your HTML which is incorrect.
The html may or may not have been generated by PHP - but it's not a PHP
problem. Try alt.html to figure out what's wrong with your html.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: doctype not found? [message #173605 is a reply to message #173599] |
Wed, 20 April 2011 10:40 |
Beauregard T. Shagnas
Messages: 154 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
geoff(at)invalid(dot)invalid wrote:
> http://www.micro-active.com
> ...
> 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?
A quick look at the source of the above page shows that you are
inserting a mess of JavaScript at the top of the page -- prior to the
doctype. That's a no-no.
--
-bts
-Four wheels carry the body; two wheels move the soul
|
|
|
Re: doctype not found? [message #173606 is a reply to message #173599] |
Wed, 20 April 2011 11:00 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
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
--
|
|
|
Re: doctype not found? [message #173607 is a reply to message #173606] |
Wed, 20 April 2011 12:20 |
geoff
Messages: 8 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
On Wed, 20 Apr 2011 13:00:34 +0200, "Álvaro G. Vicario"
<alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
> There is no DOCTYPE *on top* of the document. Even if there was one, you
Álvaro
thanks for your comments.
I have added the doctype etc info to the php at the top of the page
and now the page is centred in IE9 and the other browsers and W3C HTML
checker finds no errors.
Seems OK?
Cheers
Geoff
<?php
session_start();
setcookie("firsttime","no");
$firsttime = $_COOKIE[firsttime];
if (@$firsttime != "no") {
echo "
<!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'>
<!-- SEARCH-ENGINE-OFF -->
<title>Micro Active Net Ltd Home page</title>
<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>
";
}
?>
>
> --
> -- 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
|
|
|
Re: doctype not found? [message #173609 is a reply to message #173607] |
Wed, 20 April 2011 12:28 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
El 20/04/2011 14:20, geoff(at)invalid(dot)invalid escribió/wrote:
> On Wed, 20 Apr 2011 13:00:34 +0200, "Álvaro G. Vicario"
> <alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
>
>> There is no DOCTYPE *on top* of the document. Even if there was one, you
>
> Álvaro
>
> thanks for your comments.
>
> I have added the doctype etc info to the php at the top of the page
> and now the page is centred in IE9 and the other browsers and W3C HTML
> checker finds no errors.
>
> Seems OK?
>
> Cheers
>
> Geoff
>
> <?php
> session_start();
> setcookie("firsttime","no");
> $firsttime = $_COOKIE[firsttime];
You don't have a constant called firsttime so this should trigger a
notice. You should enable full error reporting when developing:
ini_set('display_errors', TRUE);
error_reporting(E_ALL);
--
-- 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
--
|
|
|
Re: doctype not found? [message #173611 is a reply to message #173607] |
Wed, 20 April 2011 13:17 |
Beauregard T. Shagnas
Messages: 154 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
geoff(at)invalid(dot)invalid wrote:
> I have added the doctype etc info to the php at the top of the page
> and now the page is centred in IE9 and the other browsers and W3C
> HTML checker finds no errors.
I just ran your page by the validator again, and it still says it can't
find the doctype.
Errors found while checking this document as HTML 4.01 Transitional!
Result: 5 Errors, 5 warning(s)
Maybe it is because of the blank line before it. Maybe it is because of
the single-quote marks in your doctype. Remove the blank line in the
resultant HTML and copy/use this (with double-quotes):
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
--
-bts
-Four wheels carry the body; two wheels move the soul
|
|
|
Re: doctype not found? [message #173612 is a reply to message #173609] |
Wed, 20 April 2011 14:12 |
geoff
Messages: 8 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
On Wed, 20 Apr 2011 14:28:17 +0200, "Álvaro G. Vicario"
<alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
> You don't have a constant called firsttime so this should trigger a
> notice. You should enable full error reporting when developing:
>
> ini_set('display_errors', TRUE);
> error_reporting(E_ALL);
I have tried a whole lot of variations using
http://www.micro-active.com/index-test.php
which has
<?php
session_start();
ini_set('display_errors', TRUE);
error_reporting(E_ALL);
setcookie("firsttime","no");
$firsttime = $_COOKIE[firsttime];
if (@$firsttime != "no") {
echo "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' etc etc
but I cannot get it right - I do see the error message "undfined
constant etc".
I have tried defining it by having
var $firsttime;
var $firsttime = '';
etc etc
but need a little more help please!
Cheers
Geoff
>
>
>
> --
> -- 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
|
|
|
Re: doctype not found? [message #173613 is a reply to message #173611] |
Wed, 20 April 2011 14:49 |
Beauregard T. Shagnas
Messages: 154 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
Beauregard T. Shagnasty repliedto hisself:
> geoff(at)invalid(dot)invalid wrote:
>> I have added the doctype etc info to the php at the top of the page
>> and now the page is centred in IE9 and the other browsers and W3C
>> HTML checker finds no errors.
>
> I just ran your page by the validator again, and it still says it can't
> find the doctype.
>
> Errors found while checking this document as HTML 4.01 Transitional!
> Result: 5 Errors, 5 warning(s)
>
> Maybe it is because of the blank line before it. Maybe it is because of
> the single-quote marks in your doctype. Remove the blank line in the
> resultant HTML and copy/use this (with double-quotes):
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
And I think I'll add this, which is still OT for a PHP group, but I see
it as important. In your CSS, you've assigned a font-size of 80% ...
that is below my aged eyes' ability. And you're using Verdana. Use 100%
for your base font, and drop the overly-large Verdana font.
body {
background-image: url(pattern.png) ;
font-size:80%; /* 62.5*/
font-family:verdana,helvetica,arial,sans-serif;
line-height:1;
/*behavior: url(csshover2.htc);*/
}
line-height: 1 is less than normal. You should drop that.
Was 62.5%?? Were you reading about the horrible Clagnut method?
See: http://tekrider.net/html/fontsize.php
--
-bts
-Four wheels carry the body; two wheels move the soul
|
|
|
Re: doctype not found? [message #173614 is a reply to message #173613] |
Wed, 20 April 2011 15:29 |
geoff
Messages: 8 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
On Wed, 20 Apr 2011 10:49:55 -0400, "Beauregard T. Shagnasty"
<a(dot)nony(dot)mous(at)example(dot)invalid> wrote:
> Beauregard T. Shagnasty repliedto hisself:
>
>> geoff(at)invalid(dot)invalid wrote:
>>> I have added the doctype etc info to the php at the top of the page
>>> and now the page is centred in IE9 and the other browsers and W3C
>>> HTML checker finds no errors.
>>
>> I just ran your page by the validator again, and it still says it can't
>> find the doctype.
>>
>> Errors found while checking this document as HTML 4.01 Transitional!
>> Result: 5 Errors, 5 warning(s)
>>
>> Maybe it is because of the blank line before it. Maybe it is because of
>> the single-quote marks in your doctype. Remove the blank line in the
>> resultant HTML and copy/use this (with double-quotes):
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
>> "http://www.w3.org/TR/html4/strict.dtd">
>
> And I think I'll add this, which is still OT for a PHP group, but I see
> it as important. In your CSS, you've assigned a font-size of 80% ...
> that is below my aged eyes' ability. And you're using Verdana. Use 100%
> for your base font, and drop the overly-large Verdana font.
>
> body {
> background-image: url(pattern.png) ;
> font-size:80%; /* 62.5*/
> font-family:verdana,helvetica,arial,sans-serif;
> line-height:1;
> /*behavior: url(csshover2.htc);*/
> }
>
> line-height: 1 is less than normal. You should drop that.
> Was 62.5%?? Were you reading about the horrible Clagnut method?
> See: http://tekrider.net/html/fontsize.php
I will take a look at the font sizes but just for the minute I have
gone back to
http://www.micro-active.com/index.php
which is seen by W3C HTML Checker as HTML 4.01 Strict and sees no
errors.
But if I add a line such as
error_reporting(E_ALL);
I then get loads of errors in the Checker.
Plus in the normal browser window I see "undefined constant firsttime"
line 5
see
http://www.micro-active.com/index2.php
?!
Geoff
|
|
|
Re: doctype not found? [message #173616 is a reply to message #173612] |
Wed, 20 April 2011 16:05 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
El 20/04/2011 16:12, geoff(at)invalid(dot)invalid escribió/wrote:
> On Wed, 20 Apr 2011 14:28:17 +0200, "Álvaro G. Vicario"
> <alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
>
>> You don't have a constant called firsttime so this should trigger a
>> notice. You should enable full error reporting when developing:
>>
>> ini_set('display_errors', TRUE);
>> error_reporting(E_ALL);
>
>
> I have tried a whole lot of variations using
>
> http://www.micro-active.com/index-test.php
>
> which has
>
> <?php
> session_start();
> ini_set('display_errors', TRUE);
> error_reporting(E_ALL);
> setcookie("firsttime","no");
> $firsttime = $_COOKIE[firsttime];
> if (@$firsttime != "no") {
> echo "
> <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' etc etc
>
> but I cannot get it right - I do see the error message "undfined
> constant etc".
>
> I have tried defining it by having
>
> var $firsttime;
> var $firsttime = '';
>
> etc etc
>
> but need a little more help please!
Do you even know what a constant is?
I suggest you have a look at this chapter in the PHP manual:
http://es.php.net/manual/en/langref.php
You absolutely need to read the complete chapter, but for your immediate
needs you can start with the "Strings" and "Arrays" sections.
>> --
>> -- 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
There's no need to quote signatures ;-)
--
-- 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
--
|
|
|
Re: doctype not found? [message #173618 is a reply to message #173614] |
Wed, 20 April 2011 16:51 |
Beauregard T. Shagnas
Messages: 154 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
geoff(at)invalid(dot)invalid wrote:
> Beauregard T. Shagnasty wrote:
>> Beauregard T. Shagnasty repliedto hisself:
>>> I just ran your page by the validator again, and it still says it can't
>>> find the doctype.
>>>
>>> Errors found while checking this document as HTML 4.01 Transitional!
>>> Result: 5 Errors, 5 warning(s)
>>>
>>> Maybe it is because of the blank line before it. Maybe it is because of
>>> the single-quote marks in your doctype. Remove the blank line in the
>>> resultant HTML and copy/use this (with double-quotes):
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>> "http://www.w3.org/TR/html4/strict.dtd">
>>
>> And I think I'll add this, which is still OT for a PHP group, but I
>> see it as important. In your CSS, you've assigned a font-size of 80%
>> ... that is below my aged eyes' ability. And you're using Verdana.
>> Use 100% for your base font, and drop the overly-large Verdana font.
>>
>> body {
>> background-image: url(pattern.png) ;
>> font-size:80%; /* 62.5*/
>> font-family:verdana,helvetica,arial,sans-serif;
>> line-height:1;
>> /*behavior: url(csshover2.htc);*/
>> }
>>
>> line-height: 1 is less than normal. You should drop that.
>> Was 62.5%?? Were you reading about the horrible Clagnut method?
>> See: http://tekrider.net/html/fontsize.php
>
> I will take a look at the font sizes but just for the minute I have
> gone back to
>
> http://www.micro-active.com/index.php
>
> which is seen by W3C HTML Checker as HTML 4.01 Strict and sees no
> errors.
At the moment...
> But if I add a line such as
> error_reporting(E_ALL);
> I then get loads of errors in the Checker.
Well, yeah. "errors" are not valid HTML!
> Plus in the normal browser window I see "undefined constant firsttime"
> line 5
Follow Alvaro's advice about " constants " and such. Your page inserts
HTML *above* (preceding) the doctype about your errors, thus blowing the
validity of it. Look at the source!
> see
> http://www.micro-active.com/index2.php
Errors found while checking this document as HTML 4.01 Transitional!
Result: 22 Errors, 8 warning(s)
In your CSS, please don't change the font-size and boldness of links
when hovered. Doing so makes the text jump about. A color change should
be sufficient.
--
-bts
-Four wheels carry the body; two wheels move the soul
|
|
|
Re: doctype not found? [message #173624 is a reply to message #173616] |
Wed, 20 April 2011 22:10 |
geoff
Messages: 8 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
On Wed, 20 Apr 2011 18:05:18 +0200, "Álvaro G. Vicario"
<alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
Álvar
I have given up the approach I was using and the following seems OK at
http://www.micro-active.com/index.php
The sound is played on the first visit in a session but not on the
second and I get no php errors and also the W3C HTML Validator finds
no errors.
I am checking to see that if the $_SESSION["index_with_sound"] is not
set then the the audio is played. The $_SESSION["index_with_sound" is
set after that part of the code so when the user goes to another page
and then returns to index.php the $_SESSION["index_with_sound"] is set
and so no sound is played.
The logic seem OK to you?
There is a problem with IE9 in that although the page is centred on
the first visit (using css), after going to another page and then
returning to the index.php file, the page is no longer centred and the
drop down menu no longer works!
This does not happen with other browsers.
Any ideas?
Cheers
Geoff
<?php
//error_reporting(E_ALL);
session_start();
if (!isset($_SESSION["index_with_sound"])) {
echo "
<!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'>
<!-- SEARCH-ENGINE-OFF -->
<title>Micro Active Net Ltd Home page</title>
<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>
";
}
$_SESSION["index_with_sound"] = "yes";
?>
|
|
|
Re: doctype not found? [message #173627 is a reply to message #173624] |
Thu, 21 April 2011 03:48 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 4/20/2011 6:10 PM, geoff(at)invalid(dot)invalid wrote:
> On Wed, 20 Apr 2011 18:05:18 +0200, "Álvaro G. Vicario"
> <alvaro(dot)NOSPAMTHANX(at)demogracia(dot)com(dot)invalid> wrote:
>
> Álvar
>
> I have given up the approach I was using and the following seems OK at
>
> http://www.micro-active.com/index.php
>
> The sound is played on the first visit in a session but not on the
> second and I get no php errors and also the W3C HTML Validator finds
> no errors.
>
Any site which interferes with the music I currently have on my machine
will not receive a second visit from me. A lot of others feel the same.
> I am checking to see that if the $_SESSION["index_with_sound"] is not
> set then the the audio is played. The $_SESSION["index_with_sound" is
> set after that part of the code so when the user goes to another page
> and then returns to index.php the $_SESSION["index_with_sound"] is set
> and so no sound is played.
>
> The logic seem OK to you?
>
Only if you want people to visit only once then leave.
> There is a problem with IE9 in that although the page is centred on
> the first visit (using css), after going to another page and then
> returning to the index.php file, the page is no longer centred and the
> drop down menu no longer works!
>
> This does not happen with other browsers.
>
> Any ideas?
>
> Cheers
>
> Geoff
>
Check your HTML after they've visited other pages. But this is NOT a
PHP problem.
<irrelevant code snipped>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|
Re: doctype not found? [message #173628 is a reply to message #173627] |
Thu, 21 April 2011 05:33 |
geoff
Messages: 8 Registered: April 2011
Karma: 0
|
Junior Member |
|
|
On Wed, 20 Apr 2011 23:48:16 -0400, Jerry Stuckle
<jstucklex(at)attglobal(dot)net> wrote:
>> The logic seem OK to you?
>>
>
> Only if you want people to visit only once then leave.
Jerry
OK! I am coming round to agreeing with you.
> Check your HTML after they've visited other pages. But this is NOT a
> PHP problem.
I looked at the html on returning to index.php and low and behold the
doctype info was missing! Once I added an "else" section to the php
which echoed the doctype code info on the return when the
$_SESSION["index_with_sound"] was set the page centred itself and the
drop down menu worked.
Interesting that browsers other than IE9 somehow still showed the
doctype code on return!?
Cheers
Geoff
|
|
|