anks Posted May 22, 2010 Share Posted May 22, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/ Share on other sites More sharing options...
Daniel0 Posted May 22, 2010 Share Posted May 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061967 Share on other sites More sharing options...
PFMaBiSmAd Posted May 22, 2010 Share Posted May 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061968 Share on other sites More sharing options...
anks Posted May 22, 2010 Author Share Posted May 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061974 Share on other sites More sharing options...
anks Posted May 22, 2010 Author Share Posted May 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061975 Share on other sites More sharing options...
Daniel0 Posted May 22, 2010 Share Posted May 22, 2010 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] Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061981 Share on other sites More sharing options...
ignace Posted May 22, 2010 Share Posted May 22, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061982 Share on other sites More sharing options...
anks Posted May 22, 2010 Author Share Posted May 22, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1061992 Share on other sites More sharing options...
ignace Posted May 22, 2010 Share Posted May 22, 2010 Yes. Or change your doctype to XHTML Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062001 Share on other sites More sharing options...
anks Posted May 23, 2010 Author Share Posted May 23, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062137 Share on other sites More sharing options...
Tazerenix Posted May 23, 2010 Share Posted May 23, 2010 you have <ul id="departments"></ul> before your doctype Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062153 Share on other sites More sharing options...
anks Posted May 23, 2010 Author Share Posted May 23, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062163 Share on other sites More sharing options...
Daniel0 Posted May 23, 2010 Share Posted May 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062165 Share on other sites More sharing options...
PFMaBiSmAd Posted May 23, 2010 Share Posted May 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062167 Share on other sites More sharing options...
anks Posted May 23, 2010 Author Share Posted May 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062170 Share on other sites More sharing options...
anks Posted May 23, 2010 Author Share Posted May 23, 2010 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!!! Quote Link to comment https://forums.phpfreaks.com/topic/202585-no-doctype-found-how-come/#findComment-1062174 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.