We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4369
    • 31 Posts
    Hello.

    I’m new at this MODx CMS, and I love it! It’s so clean and effective!

    I have 2 questions:
    1) About the menu - how can I make the menu show only the children’s of the current category ?
    Explanation - let’s say I have in the menu "Home (which is a single page), software (which is a folder that contains child pages), hardware (the same as software).
    When I’m in the Home, I only want to see the three items (Home, Software and Hardware) without their children pages. And when I’m inside a child page of Software, I want to see the Home, Software with all of it’s children’s, and hardware as a closed thread - without it’s children’s.

    How can I do such a thing?


    2) When I first installed MODx, it asked me what do I want to installed (I believe they were snippets or plugins or something like that).
    How can I install items I didn’t select in the installation process ?


    Thank you very much for your help!
      • 11975
      • 2,542 Posts
      hello,

      1/When you call dropmenu snippet you can add parameters to select the startDoc
      [[DropMenu?startDoc=[*parent*] ]]
      you can combine this parameter to set levelLimit (how much deep you want to go from the startDoc)
      [[DropMenu?startDoc=[*parent*] &levelLimit=3 ]]

      2/To add snippets, chunks, etc ... in the manager : ressources> manage ressources
      Select the tab according you needs (snippet , ...) > new
      and copy and paste the code snippet. Some snippets requires external files so you need to upload them in /yourmodxfolder/assets/snippets

      Hope this helps smiley
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 4369
        • 31 Posts
        First of all, thank you for your help.
        About your answer to the menu thingy - what I mean is like the menu in MODx website - when you’re inside Documentation, you have the lower menu. When you click on one of the items in the lower menu, you get a page with the same menu, but with that specific category’s childrens. And when you switch to another category, you don’t see the previous category’s childrens, but you see the current category’s childrens.
        Do you understand what I’m trying to say?

        Your solution, makes my root categories disappear when I’m inside one category.
          • 11975
          • 2,542 Posts
          Ok i misunderstood smiley

          I guess you can achieve this using css and dropmenu call with startDoc=0
          Have a look to this thread --> http://modxcms.com/forums/index.php/topic,3682.0.html
            Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
            • 4369
            • 31 Posts
            O.k great! That’s exactly what I was looking for!
            But now, another question about the menu:
            Lets say I have only a 2 level menu.
            I have 5 items in it, where items number 2 and 3 are folders and have children.
            I want to display the level 1 menu in a div called "level1" and the level 2 items in another place in the page in a div called "level2".

            Which means, I want to display the 1st level items (without their children) in certain place, and if an item has children (it’s a folder), then I want to display it’s children in another place in the page.

            How can I do that?

            And once again, Thank you!!
              • 11975
              • 2,542 Posts
              that’s quite simple you need to call dropmenu twice smiley

              For your second menu in the page to display its childs, use this call
              [[DropMenu?startDoc=[*parent*] &topnavClass=`menu2` &levelLimit=1 ]]
              topNavClass is the css class applied to the top ul

              for instance with these settings the output will look like something like this:
              <ul class=’menu2’>
              <li>link 1</li>
              <li>link 2</li>
              </ul>


              Have good time with modx
                Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
                • 4369
                • 31 Posts
                lost you there...
                I mean I tried something like that just without the "&topnavClass=`menu2`" you entered there.
                Why do I need this?

                Anyway, I tried it and it didn’t worked. It just showes the 1st level menu in both places.
                • 1. Because you have two menus and need different class names to style the different menus. Otherwise, they’ll both be "topnav" or whatever the default is, and you can’t style them differently. Well, I suppose you could, if each menu is in a div with different IDs, but it would be much more awkward.

                  2. If you call dropmenu with the startDoc as [*parent*], when you are on a level 2 page it will show only a list of documents under the parent document.

                  For example, if I click on your item #2, then the startDoc will still be 0, since I’m still in a level 1 document. But if I go to a page below #2, then it will show a list of the items under document #2. So I always put menus like this in a TV, and then use [*id*] for the top-level pages, so that the menu will show the items under that document, and in its children I’ll use [*parent*]. To make it easier for myself, I make the TV default value [*parent*], then I only need to change the few top-level documents to use [*id*], the rest will be by default what I want.
                    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
                    • 4369
                    • 31 Posts
                    O.k. I lost you!
                    I’m new to MODx and I completely lost you on number 2.

                    If I do what was suggested before, and I’ll be for example on the Home page, I will have the first menu with all the 1st level items, and the second menu with the same (all the 1st level items). So, it will be impossible to get to any 2nd level item. But, if I’ll will get to any 2nd level item, only then I will see it’s other 2nd level item "friends".
                    So it’s a problem.
                    • I understood that you have two menus. One will always show the top level items, the other will show the second level items appropriate to the top-level item the user selected.

                      If you put the second dropmenu snippet in a TV, and use the TV tags in place of the DropMenu tags in your template at that location, then you can edit the dropmenu arguments for each document. For top-level documents, use [*id*] as the startDoc value. For second-level documents, use [*parent*].

                      This way the second menu will show whatever pages are below the selected top level page. And when actually on a second level page, using the parent’s id will show the pages below that page’s parent (siblings).

                      So create a new TV (eg. SideMenu). As its default value simply put [[DropMenu?startDoc=[*parent*] &topnavClass=`menu2` &levelLimit=1 ]]. Check the box for your template to allow access.

                      Now in each document using that template you’ll have an additional editing field for the TV. You’ll only need to edit it for the parent documents; set the startDoc to [*id*] instead of [*parent*]. The child pages will have the correct value by default.

                      Use the TV in your template instead of the snippet tags to display the correct menu for each page; [*SideMenu*].

                      If the top level page selected has no children, then the second menu won’t show anything.
                        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