We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23054
    • 62 Posts
    I have some documents that are not displayed in menu tree and that are in no menu folders.

    Is there a way to mark the appropriate menu document as ’current’ in order to show where in the menu navigation the user is ?

    (I use the snippet ’DropMenuLevel’ which I found in these forums somewhere)

    Besides I wonder - in this special case the current document is a link even if it is displayed in content, in other cases it works fine.
      • 22815
      • 1,097 Posts
      I’m confused. If the document isn’t in a tree and isn’t in a menu folder, where in the menu navigation is the user?
        No, I don't know what OpenGeek's saying half the time either.
        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
        Forum: Where to post threads about add-ons | Forum Rules
        Like MODx? donate (and/or share your resources)
        Like me? See my Amazon wishlist
        MODx "Most Promising CMS" - so appropriate!
        • 1804
        • 13 Posts
        I’m looking at the same problem.

        There are times when you need to create a special page that is associated with page in the navigation, but you don’t want the special page to appear by itself in the nav AND you want to show the associated page as the current page to the user.
          • 7923
          • 4,213 Posts
          I don’t know if I have still understand anything of this, but are you saying that when user goes to a page, he should get the contents of another page or redirected to another page? here’s some random answers:

          There is the "show in menu" checkbox what can be used to hide pages from the navigation.
          You can use getField snippet to get content from another document.
          You can make some document as a weblink to show in menu and when clicked it can redirect to some other document.
          You can make a redirect snippet to redirect from one document to another.

          if (isset ($redirectTo)) {
          return $modx->sendRedirect($modx->makeUrl($redirectTo));
          }


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 22815
            • 1,097 Posts
            No, I don’t think any of those are the answer..

            I think this what they’re after:

            Say there was a Contact Us form page, and filling in the form takes you to a thank-you page.
            The form page is on the menu, but the thank-you page isn’t.
            But they want the Contact Us to be highlighted on the menu.

            So it is like the thank you page "pretends" to be the Contact Us page.

            I don’t know how this would be solved.
              No, I don't know what OpenGeek's saying half the time either.
              MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
              Forum: Where to post threads about add-ons | Forum Rules
              Like MODx? donate (and/or share your resources)
              Like me? See my Amazon wishlist
              MODx "Most Promising CMS" - so appropriate!
            • Make the "thank-you" page be a child of the Contact page, but not show in menu. The Contact page link should still be given the "here" class, since it is the parent of the current page.

              demo at http://www.sottwell.com (Demos->Hidden Pages) The actual demo is in the right column of the demo page.

              If you want to see the document tree of this, log in to my Manager as "guest", password "guestuser" and you will be able to see everything.

                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
                • 23054
                • 62 Posts
                Quote from: sottwell at Jul 25, 2006, 04:49 AM

                Make the "thank-you" page be a child of the Contact page, but not show in menu. The Contact page link should still be given the "here" class, since it is the parent of the current page.

                demo at http://www.sottwell.com (Demos->Hidden Pages) The actual demo is in the right column of the demo page.

                If you want to see the document tree of this, log in to my Manager as "guest", password "guestuser" and you will be able to see everything.

                First to clearify things for some users here - User "antiver" and "PaulGregory" describe the problem better as me in my own words.

                The idea of hiding menu items I had too and I implemented it - but than I got some problems with the CSS, I haven’t not solved so far.
                And I don’t know whether or not this is possible with the snippet ’DropMenuLevel’.

                The first menu level shall have a different style as the second level (that means the first level shall be displayed as folder, the second as item with different colors and margins and borders)

                desired display
                ------
                | menu|
                ------
                   
                     item 1
                     item 2

                and so on

                What I got is this

                ------
                | menu|
                ------
                     -------
                     | item 1|
                     -------

                    item 2


                and so on.

                If the DropMenuLevel-snippet would output id’s for every menu/menu item it would be easy to format the special menu like an item. But so far I have no idea how to solve this - that’s way I thought the way of ’assigning’ a page as current item would be easier.

                grin CSS layout meanwhile solved

                • Ah, yes. That takes some very convoluted CSS. I did hack DropMenu at one point to give each li tag its own class, using the document’s ID (class="item34", for example) which let me style things in a very specific manner as to colors etc. I just added
                  class="item'.$child['id'].' 

                  to the lines that generate the links. You could prefex this with list or link and have it for both the <a> tags and the <li> tags.
                    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
                    • 23054
                    • 62 Posts
                    Quote from: sottwell at Jul 25, 2006, 07:02 AM

                    Ah, yes. That takes some very convoluted CSS. I did hack DropMenu at one point to give each li tag its own class, using the document’s ID (class="item34", for example) which let me style things in a very specific manner as to colors etc. I just added
                    class="item'.$child['id'].' 

                    to the lines that generate the links. You could prefex this with list or link and have it for both the <a> tags and the <li> tags.

                    And so will I do.
                    Anyway it would be a good idea that these snippets have a parameter to say generate id’s - yes or no.