Jump to content

Recommended Posts

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:

 

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

 

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

Link to comment
https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/
Share on other sites

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]

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?

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?

 

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.

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.

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.

 

Ok, it seems i was not declairing the class in CSS properely, i was prefixing  the Class with "#" and not "."

 

So its woking now.

 

I appreciate words from all and thanks again!!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.