Author Topic: "No DOCTYPE Found" How come?  (Read 1379 times)

0 Members and 1 Guest are viewing this topic.

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
"No DOCTYPE Found" How come?
« on: May 22, 2010, 01:21:06 PM »
Folks,

I ran my site through a HTML validator, it says No DOCTYPE Found, but in my Index.php i have:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

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


See what w3 Validator has to say:

Code: [Select]
http://validator.w3.org/check?uri=http%3A%2F%2Fterrygoodkind.co.uk%2F&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.767
Quote
Warning No DOCTYPE  found, and unknown root element. Aborting validation.
Unable to Determine Parse Mode!

Am not able to understand, what wrong am doing in DOCTYPE.

Thanks all

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #1 on: May 22, 2010, 01:26:47 PM »
It might be because you're both declaring an XML namespace and setting the DOCTYPE to an HTML one and that's what's confusing it.

Offline PFMaBiSmAd

  • Guru
  • 'Insane!'
  • *
  • Posts: 14,586
  • In Coding, Automatic means you write code to do it
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #2 on: May 22, 2010, 01:31:39 PM »
According to the source that the validator used, your doctype tag is on line 7 in your file and you have another HTML tag before it in the file as well.
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #3 on: May 22, 2010, 01:48:24 PM »
It might be because you're both declaring an XML namespace and setting the DOCTYPE to an HTML one and that's what's confusing it.

I tried to remove one, and still the same validation result.

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #4 on: May 22, 2010, 01:49:13 PM »
According to the source that the validator used, your doctype tag is on line 7 in your file and you have another HTML tag before it in the file as well.

I can not see any HTML tag before DOCTYPE declaration.

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #5 on: May 22, 2010, 02:10:22 PM »
According to the source that the validator used, your doctype tag is on line 7 in your file and you have another HTML tag before it in the file as well.

I can not see any HTML tag before DOCTYPE declaration.

Then you need to look closer.

[attachment deleted by admin]

Offline ignace

  • Guru
  • Freak!
  • *
  • Posts: 5,093
  • Gender: Male
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #6 on: May 22, 2010, 02:11:26 PM »
You are using the incorrect DTD. You are using the HTML 4.01 DTD and defining an XML namespace which is only implemented as of XHTML 1.0. Remove the xmlns.
Developer from Belgium, Vlaams-Brabant

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #7 on: May 22, 2010, 02:27:16 PM »
You are using the incorrect DTD. You are using the HTML 4.01 DTD and defining an XML namespace which is only implemented as of XHTML 1.0. Remove the xmlns.

My existing code is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

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


You mean to say, i need to completely remove the Second declaration and keep only the <html>. Right?

Offline ignace

  • Guru
  • Freak!
  • *
  • Posts: 5,093
  • Gender: Male
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #8 on: May 22, 2010, 03:02:51 PM »
Yes. Or change your doctype to XHTML
Developer from Belgium, Vlaams-Brabant

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #9 on: May 23, 2010, 12:48:03 AM »
According to the source that the validator used, your doctype tag is on line 7 in your file and you have another HTML tag before it in the file as well.

I can not see any HTML tag before DOCTYPE declaration.

Then you need to look closer.


Oh Yes....  :-\

After scretching head for past 4-5 hours, am still not able to understand how is this heppening?

The code that is being used for this is:

echo '<ul id="departments">';

	
foreach(
$keyword_list as $keywordname
	


	
{


	
$keywordname_url stripslashes(str_replace('+''-'urlencode($keywordname)));
	
$navigation.= "<li><a href='".($keywordname_url).".htm'>".Ucwords($keywordname)."</a></li>";
	
	

	
	
}
echo 
'</ul>';

}


This code is in Function.php file and this file is being called in index.php right at the top, even before <html> tag.

<?php
// Change error reporting to minimum
error_reporting(E_ALL E_NOTICE);

include(
"config.php");
include(
'functions.php');
?>


Will this help to locate the problem bit?

Offline Tazerenix

  • Enthusiast
  • Posts: 228
  • Gender: Male
  • Call me taz :D
    • View Profile
    • Tazerenix Productions
Re: "No DOCTYPE Found" How come?
« Reply #10 on: May 23, 2010, 03:04:20 AM »
you have <ul id="departments"></ul> before your doctype
Quote
"War does not determine who is right... Only who is dead" - Unknown



NOTE: Most of the code I post is untested. So hope for the best

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #11 on: May 23, 2010, 05:05:05 AM »
you have <ul id="departments"></ul> before your doctype

Yes, thats y i shared the info in my last post, see if you could locate, what am mi doing wrong?

Offline Daniel0

  • Administrator
  • 'Insane!'
  • *
  • Posts: 11,815
  • Gender: Male
  • ^bb|[^b]{2}$
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #12 on: May 23, 2010, 06:04:37 AM »
you have <ul id="departments"></ul> before your doctype

Oh really? Who would have known that?!

Maybe you should read the topic before you reply so you don't repeat other people. PFMaBiSmAd said that in the second reply to this topic.

Offline PFMaBiSmAd

  • Guru
  • 'Insane!'
  • *
  • Posts: 14,586
  • In Coding, Automatic means you write code to do it
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #13 on: May 23, 2010, 06:29:04 AM »
anks, you are directly echoing two lines of HTML instead of concatenating them with the $navigation variable.

Also, based on the number of blank lines, you are apparently echoing other things or have something not enclosed within <?php ?> tags before the doctype tag.
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.

Offline anksTopic starter

  • Irregular
  • Posts: 43
    • View Profile
Re: "No DOCTYPE Found" How come?
« Reply #14 on: May 23, 2010, 07:34:31 AM »
anks, you are directly echoing two lines of HTML instead of concatenating them with the $navigation variable.

Also, based on the number of blank lines, you are apparently echoing other things or have something not enclosed within <?php ?> tags before the doctype tag.

Hello,

Ok, i have removed both echo statments and concatenated with the $navigation. like:

$navigation.= "<li class='departments'><a href='".($keywordname_url).".htm'>".Ucwords($keywordname)."</a></li>";

Its showing no error but the Department class is not getting applied.  :-\

But if i echo, as i did earlier, this class gets applied.