The symptoms:

1. IE is rendering the nav menu (normally located in the header) in the absolute upper-left corner of the screen on certain pages, and the drop-downs don't work at all. When resizing the window, the menu instantly realigns itself to the proper location, but the drop-downs still don't work.

2. IE also spits out the following error:

Line: 2
Char: 1
Error: Syntax error
Code:0
URL: [my url]

The circumstances:

This problem appears to occur on admin/access and node/3 pages (i.e. xxx/yyy/zzz), whereas the problem does not exist in root pages (i.e. node, admin).

Thoughts:

This smells like an IE, JavaScript, and / or CSS problem.

Comments

JoshLangner’s picture

Edit: Just FYI, everything works fine in Firefox and Opera.

JoshLangner’s picture

Okay, I nailed the problem. Here is the situation: The broken code is as follows:

<style type="text/css" media="all">@import "/dev472/modules/ecommerce/cart/cart.css";</style>
<style type="text/css" media="all">@import "/dev472/themes/mollio/style.css";</style>
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="themes/mollio/ie6_or_less.css" />
<![endif]-->
<script type="text/javascript" src="themes/mollio/common.js"></script>

As you can see, the links that use "dev472/...", which is the root directory to my site, work correctly, whereas the links with "... do not.

The code on page.tpl.php that generates this is:

<?php print $styles; ?>
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="<?php print $base_url . $directory; ?>/ie6_or_less.css" />
<![endif]-->
<script type="text/javascript" src="<?php print $base_url . $directory; ?>/common.js"></script>

I changed the $base_url to be "url(NULL, NULL, NULL, FALSE)", which produces exactly what I want:

<style type="text/css" media="all">@import "/dev472/modules/ecommerce/cart/cart.css";</style>
<style type="text/css" media="all">@import "/dev472/themes/mollio/style.css";</style><!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="/dev472/themes/mollio/ie6_or_less.css" />
<![endif]-->
<script type="text/javascript" src="/dev472/themes/mollio/common.js"></script>

There. Now my the drop-downs will work with Drupal installations that have roots in subdirectories.

JoshLangner’s picture

For future reference, there are other instances of $base_url that may cause problems. Best get these fixed.

JoshLangner’s picture

Status: Active » Closed (fixed)

For future reference, there are other instances of $base_url that may cause problems. Best get these fixed.

rkerr’s picture

Suppose those should be base_path() instead of $base_url .... will update CVS in a minute.