Posted by JhonyLe on December 22, 2012 at 1:11pm
Hello.
I have a problem with display of my HTML in browser, but I don't find bug because it's very strange.
I have html.tpl.php:
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="ie6 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if IE 7]> <html class="ie7 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if IE 8]> <html class="ie8 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if gt IE 8]> <!--> <html class="" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <!--<![endif]-->
<head>
<?php print $head; ?>
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
<!-- IE Fix for HTML5 Tags -->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
<?php print $page_top; ?>
<?php print $page; ?>
<?php print $page_bottom; ?>
</body>
</html>But in browser I see this:
If I remove tags from the file like this:
<!DOCTYPE html>
<head>
<title><?php print $head_title; ?></title>
</head>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
</body>
</html>In browser I see this:
Even if I change my theme I still have this problem.
Help please! What is it may be?
PS: sorry for my english. If you don't understand me, please say about it and I will try write better.
Comments
I'm pretty sure that nothing
I'm pretty sure that nothing should be before the
<head>tag, meaning these style sheet inclusion rules must be moved:<!--[if lt IE 7]> <html class="ie6 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]--><!--[if IE 7]> <html class="ie7 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if IE 8]> <html class="ie8 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if gt IE 8]> <!--> <html class="" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <!--<![endif]-->
- Corey
http://cscrunch.com
Clear Drupal cache and
Clear Drupal cache and browser cache.
Why do you need/want a custom
Why do you need/want a custom html.tpl.php file?
I set default theme Bartik
I set default theme Bartik 7.17 (default theme) it is right because it is from box of drupal, I cleared cache of site and cache of browser, but it does not work. May be it is not problem of theme?
But it is:<!--[if lt IE 7]>
But it is:
<!--[if lt IE 7]> <html class="ie6 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]--><!--[if IE 7]> <html class="ie7 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if IE 8]> <html class="ie8 ie" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <![endif]-->
<!--[if gt IE 8]> <!--> <html class="" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"> <!--<![endif]-->
tag
<html>for different IE versions. How can I move it? But I tried remove this and it isn't help too.Do you have any non-core
Do you have any non-core module installed? I ask because I do not see that behavior from Drupal 7.
non-core
non-core modules:
admin_menu
colorbox
ctools
custom_breadcrumbs
devel - because site isn't completed yet
entity
entity_translation
entityreference
globalredirect
i18n
libraries
menu_icons
page_title
title
token
variable
views
webform
webform_localization
xmlsitemap
OK, I looked at this again,
OK, I looked at this again, and I don't think that you can use these conditional-type statements with the head statement. I haven't seen anything online addressing this either way, but your lack of success seems self-evident that it doesn't work. I would suggest finding another way to achive the effect you are looking for as it is not a Drupal-centric problem.
- Corey
http://cscrunch.com
example of this solution and
example of this solution
and I said that I tried to remove this and I write it in my question.
I took old version of site
I took old version of site (age three day) and new version of theme and it is works now. Only theme changed in old version of site and it's works now. That is says about the problem isn't of theme. Now HTML is all right, but I can not find the problem why it wasn't worked. Thank you all.
It should work - I already
It should work - I already done that. It's seems that there was something cached in your browser your code in your example #2 doesn't contain
<html class="js" lang="ru"...Do you have template_preprocess_html()?
here's my code in one of the website I created. html.tpl.php
<!DOCTYPE html><!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head profile="<?php print $grddl_profile; ?>">
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
<!--[if IE]>
<link href="<?php print base_path() . path_to_theme();?>/css/ie.css" rel="stylesheet" type="text/css" >
<![endif]-->
</head>
<body class="<?php print $classes; ?>" <?php print $attributes;?>>
<div id="skip-link">
<a href="#main-content" class="element-invisible element-focusable"><?php print t('Skip to nmain content'); ?></a>
</div>
<?php print $page_top; ?>
<?php print $page; ?>
<?php print $page_bottom; ?>
</body>
</html>