Single Dropdown Category Not Working

I have a site with a basic horizontal dropdown menu, containing a total of 8 categories, mainly created with the use of CSS3 Menu Builder, with a bit of tweaking to the Source Code here & there.

Now, the problem has had me pulling my hair out in utter confusion. What IS happening SHOULDN’T be happening (at least that’s the way I see it).

The menu (menu.html) itself is located in the Site Root with the index.php file.

At the beginning of each page I have pasted " <?php include $_SERVER[‘DOCUMENT_ROOT’] . “/menu.html”;
?> ", with places the Menu bar neatly at the top of each page, regardless of where it’s coming from.

The problem is that all the categories are doing exactly what I would expect them to do - except for the 5th one which flatly refuses to drop down EXCEPT when linked either by the “Home” or “Contact” buttons (neither of which are drop down links, although the contacts.php is to be found in the “contacts” directory, so technically there should be any difference between that & any of the other pages once open.

If it’s of any help, when I hover over the affected Menu button, rather than dropping down, a little meeage appear “Node Operations” which I don’t have clue what it means, or even if it’s related in any way.

Each dropdown is in the format:

  • Dropwn Name
  • I know the "<li class-“topmenu”> lines are identical, as they’re all copied, & pasted, with just the category name edited.

    The really confusing part is how, if I’m on either the Contact or Home page, the dropdown works fine, as do all the links within it, but from anywhere else (including from Pages within the category itself), it’s totally dea.

    It seems ‘logical’ to me that as the files are all using the same Menu Include, so long as the menu’s there it should be working exactly the same way, regardless of where it’s linking from. If it wasn’t for the fact that it works from Home & Contact, I might have thought the address was wrong in the menu somewhere, but this is obviously not the case.

    Can anyone offer any pointers?

    node operations looks to most commonly have something to do with drupal, are you using that? this doesn’t seem like a php problem at all. as you said, the menu IS including. as far as i can see, that’s the only bit of php you use and it’s working.

    it’s likely your javascript, maybe your css that’s the issue i think. if it is php, maybe some confusion?

    where are your contact, home, and other pages located? others in subfolders? if so, this line may be the problem:
    [php]

  • Page 1

  • [/php]

    as it’s looking for them relative to the page that CALLS the menu, not the menu itself. that’s the only thing that could be related to the php imo. to fix that, either hardcode the value (include http://www,sitename.com) before the /phpages/, or make use of the document root again,

    [php]

  • Dropwn Name
  • [/php]

    coding it like that allows it to move to a different domain name without needing to be edited, which may not be necessary but it’s good practice.

    To be honest, I have no idea what Drupal is, I very much doubt if I’m using that - at least, not knowingly.

    Regarding the use of “href=”<?php echo $_SERVER['DOCUMENT_ROOT']; ?>", as that is inluded in the initial Menu include, which appears to be working (apart from the problem described) I would have thought that to include it on every link would be superfluous, especially when dealing with a lot of links.

    I’ve even tried rebuilding the menu with the CSS3 Menu Builder program (which also generates the CSS files) again, from scratch but although the WYSIWYG display of the menu shows it to be working fine, it clearly isn’t when it comes to putting it into practice.

    I know it’s probably something so simple it’s staring me in the face, but buggered if I can see it.

    k.

    what’s happening, is you are including menu.html IN the page that has the include. so it is not relative to menu.html, but to the page that called it. so any links have to be reachable by any page that calls it.

    so if you have

    .. index.html menu.html phppages/ contacts/contacts.php

    when index.html includes menu.html, it would work because they are in the same place. they both see the phppages folder. but when contacts.php calls menu.html, it successfully calls because it finds menu.html, but since there is no phppages folder in the contacts folder, it would not be able to find the links it’s looking for.

    I think the organisation of the site is fine. The directory layout is in the following format (very straightforward):

    (Site Root)
    index.php
    menu.html

    /phppages
        home.php
    
          /subdirectory1
             /file1.php
             /file2.php
    
          /subdirectory2
             /file1.php
             /file2.php
    
          /contacts
             /contacts.php
             /thanks.php
    

    So the links made from the menu all work from their relative dropdowns. It’s just that 1 particular dropdown category doesn’t dropdown - it doesn’t even highlight with mouseover, as all the others do. UNLESS I access it from home.php or contact.php (neither of which have dropdown options, which I can’t help feeling must be significant).

    then as i said it’s not php. i’m guessing your javascript for your menu is the issue, and the function isn’t working right on those pages.

    even though this is a php forum, if you post the rest of your code i’ll take a look and i’m sure others will as well.

    Well, I’m not 100% certain of what I did, let alone how it worked, but I went into the style.css file & noticed the width settings were all over the place, due due automated settings in the Menu Builder software, which had been getting on my nerves, so I set them all to 12.5%, so as to set an average width for 8 buttons, which resulted in it appearing just how I wanted it, but the freaky thing about it is that in so doing it also fixed the problem of the non-operating dropdown. The category button wasn’t the widest, nor was it the narrowest.

    Go figure!

    Sponsor our Newsletter | Privacy Policy | Terms of Service