PDA

View Full Version : DD Menu always reverting back to ID



Galalad
12-10-2010, 03:00 PM
1) Script: DD Tab Menu
2) http://www.dynamicdrive.com/dynamicindex1/ddtabmenu.htm

Hi all, I hope someone can help with this issue…

I just been asked to modify a website which uses the DD Tab Menu script, and there is an issue with the navigation menu not working in IE7/8. It runs fine in Firefox, Chrome & Safari.

I have checked the output of the HTML code and <?php echo $menu_id; ?> is being returned, so I am stumped as to why it always displays menu_id = 0 when a new page is loaded in IE 7/8.

http://www.paxtonhouse.co.uk is the live site.

I have posted the php code used to obtain the current menu id which is in the header below. Any ideas anyone?

Thanks in advance.


<?php
$menu_id = 0;
$menu = array('paxton-house' => 0, 'planning-your-visit' => 1, 'things-to-see-and-do' => 2, 'whatson' => 3, 'weddings-and-functions' => 4, 'learning-at-paxton' => 5, 'contact' => 6);
if ( isset($menu[$sf_request->getParameter('module')]) )
{
$menu_id = $menu[$sf_request->getParameter('module')];
}
?>

<script type="text/javascript">
<!--
//<![CDATA[
// Tab Menu
ddtabmenu.definemenu("menu", <?php echo $menu_id; ?>);
//]]> -->
</script>

ddadmin
12-10-2010, 09:52 PM
Hmm since you're using PHP to output the initialization code, that output will be the same regardless of which browser you're using. In other words, in FF for example, I see the same thing as in IE when I view source on your page:


ddtabmenu.definemenu("menu", 0);

As far as why 0 is getting output, this is strictly an issue with your logic inside the PHP code. There isn't enough info just based on the above to say what that is.

Galalad
12-14-2010, 11:41 AM
Thanks for looking into this, I appreciate your time.

I am still perplexed as to why this would be happening, as you rightly say the code being output is providing the correct menu ID in all browsers.

In IE though, when you click on a menu item, eg What's On?, the submenu displays temporarily, then as soon as the "What's On?" page loads, the menu/submenu reverts back to the first menu with ID = 0.

If anyone else has any ideas why this may be happening, I'd really appreciate it.

ddadmin
12-14-2010, 09:00 PM
Does the issue still occur in IE if you revert your current modified version of ddtabmenu.js to the original one (http://www.dynamicdrive.com/dynamicindex1/ddtabmenufiles/ddtabmenu.js)?

Galalad
12-15-2010, 06:51 PM
I'll give that a try and report back. Thanks for the tip.

UPDATE:

I just tried the original ddtabmenu.js script as you suggested. The submenu now appears on hovering over the top level (which it didn't before and at least allows the selection of submenu items), but the submenu still reverts back to the first menu with ID = 0 when a new page is loaded.

Getting closer!

ddadmin
12-16-2010, 05:12 AM
Testing your page offline in IE, it seems if I temporarily remove the other scripts on your page, the expected sub menu gets correctly shown. In other words, I removed the following lines in gray from your page:


<script type="text/javascript" src="/js/jquery.js"></script>

<script type="text/javascript" src="/js/jquery.cycle.js"></script>
<script type="text/javascript" src="/js/jquery.replace.js"></script>
<script type="text/javascript" src="/js/jquery.pngfix.js"></script>
<script type="text/javascript" src="/js/jquery.fancybox.js"></script>
<script type="text/javascript" src="/js/tabmenu.js"></script>
<script type="text/javascript" src="/js/content.js"></script>


Can you give that a try?

Galalad
12-16-2010, 08:43 AM
Superb, thanks for pointing me in the right direction, there was a reference to

if ( !ddtabmenu["menu-menuitems"] )
{
ddtabmenu.definemenu("menu", 0)
}
in the content.js file which was causing the issue.

Many thanks for helping in this matter. I knew we'd get there in the end.
Craig