We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11526
    • 93 Posts
    I have unchecked the option "Show in menu", but the page still display in my menu...

    I think probably it has something to do with my MenuBuilder snippet. The code for this snippet is:
    if(!isset($id)) {
        $id = $etomite->documentIdentifier; //current document
    }
    
    $indentString="";
    
    if(!isset($indent)) {
        $indent = "";
        $indentString .= "";
    } else {
        for($in=0; $in<$indent; $in++) {
            $indentString .= " ";
        }
        $indentString .= "» ";
    }
    
    $children = $etomite->getActiveChildren($id); $menu = ""; $childrenCount = count($children); $active="";
    if($children==false) {
        return false;
    }
    for($x=0; $x<$childrenCount; $x++) {
    	if($children[$x]['id']==$etomite->documentIdentifier) {
    		$active="class='highLight'";
    	} else {
    		$active="";
    	}
    	if($children[$x]['id']==$etomite->documentIdentifier || $children[$x]['id']==$etomite->documentObject['parent']) {
    		$menu .= "<a ".$active." href='[~".$children[$x]['id']."~]'>$indentString".$children[$x]['pagetitle']."</a>[[MenuBuilder?id=".$children[$x]['id']."&indent=2]]";	
    	} else {
    		$menu .= "<a href='[~".$children[$x]['id']."~]'>$indentString".$children[$x]['pagetitle']."</a>";
    	}
    }
    return $menu."";


    How can i alter this code, so the documents with the option "Show in Menu" unchecked will not be displayed in the menu?

    BTW, i am using ModX 0.9.1rev 646.

    TIA!
    • That’s why DropMenu is the default and recommended menu snippet. You’ll need to examine the code of DropMenu to see how it deals with the show in menu item, then incorporate that into your menubuilder snippet.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 11526
        • 93 Posts
        Quote from: sottwell at Mar 13, 2006, 05:00 PM

        That’s why DropMenu is the default and recommended menu snippet. You’ll need to examine the code of DropMenu to see how it deals with the show in menu item, then incorporate that into your menubuilder snippet.

        Ok, thnx 4 your quick reply...

        I will give it a try smiley

        Or maybe i will just using the Dropmenu smiley
          • 11526
          • 93 Posts
          Quote from: Gust at Mar 14, 2006, 07:50 AM

          Ok, thnx 4 your quick reply...

          I will give it a try smiley

          Or maybe i will just using the Dropmenu smiley

          Just tryed DropMenu, but is more a SiteMap than a Menu for the site. I want a menu where it just show level 1 documents, when you click on a level 1document, then the children-documents of that level 1 document are shown.

          Any snippet that will do that? Or is my only option to change the MenuBuilder-snippet?
          • If you want the menu to have several levels, but only show the sublevels when you’ve selected an option, it’s done with CSS.

            li ul{
            display:none;
            ]
            li.here ul{
            display:block;
            }
            
            
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 11526
              • 93 Posts
              Quote from: sottwell at Mar 14, 2006, 09:11 AM

              If you want the menu to have several levels, but only show the sublevels when you’ve selected an option, it’s done with CSS.

              li ul{
              display:none;
              }
              li.here ul{
              display:block;
              }
              


              I have tryed to get MenuDrop up and running, but i can’t remove the list-item and margin-left, without getting errors...

              So i want to have a menu like:
              Link 1
              Link 2
              Link 3
              Link 4


              And when you click on link 2 for example, you should get
              Link 1
              Link 2
                   sublink 1
                   sublink 2
                   sublink 3
              Link 3
              Link 4


              Now i am getting this:

              • Link 1
              • Link 2
              • Link 3
              • Link 4
              • Here’s probably one of the definitive works on the subject:

                http://www.alistapart.com/articles/taminglists/

                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 4095
                  • 372 Posts
                  Quote from: Gust at Mar 14, 2006, 12:43 PM


                  I have tryed to get MenuDrop up and running, but i can’t remove the list-item and margin-left, without getting errors...

                  Now i am getting this:

                  • Link 1
                  • Link 2
                  • Link 3
                  • Link 4

                  Use CSS again......

                  li{
                  list-style:none;
                  margin:0;
                  )

                  Have a look at my CSS for ideas if you want, look for /*MENU*/

                  it works fine with one submenu, and although a sub submenu works, there are issues styling it which I have never resolved. This is discribed in my Sandbox if you want to see the results.

                  http://www.emanz.ac.nz/assets/site/briggsy/style.css
                    [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
                    Admin Sandbox Login: sandbox Password: castle