We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3496
    • 101 Posts
    If you change the menu-index of a MODx resource, the result can be that two resources have the same menu index.
    Wouldn’t it be more logical (and less prone to errors) for the MODx manager to automatically renumber the menu indexes?
    Thanks.
    Best regards,
    Black Raven
      • 3749
      • 24,544 Posts
      One advantage of leaving them alone is that you can give a page and index of 999 and it will always appear at the end of the menu.

      If duplicate menu indexes cause a problem, it’s pretty easy to correct.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 3496
        • 101 Posts
        Hi BobRay,

        Thanks for the response. And I agree that it would be nice if an index like 999 would keep that number.

        On the other hand is the current situation sometimes confusing for editors.

        Possible solution for both: only do automatic renumberering for those cases where two menuindexes are indeed the same.
        (pushing all resources one menuindex up, until there is no "collision" anymore)
          • 3749
          • 24,544 Posts
          Not a bad idea. smiley

          You could file it as a feature request via the Jira link at the top of this page. Ideally, it would warn the user on non-zero, non-unique menu indexes and send them back to the form.

          In the meantime, you could do it with a plugin attached to the OnBeforeDocFormSave event.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 3496
            • 101 Posts
            Bob,
            Thanks for your help; the suggestion is now entered in Jira (http://svn.modxcms.com/jira/browse/MODX-1637).

            I must admit I dislike sending the user(editor) back to the form; what if (s)he wanted exactly what (s)he asked?
            I prefer the MODx manager to make an educated guess about what the user wanted to accomplish (and that will almost never be: have two resources with the same menuindex) - and take action accordingly.
              • 3749
              • 24,544 Posts
              Quote from: Black at Feb 07, 2010, 04:01 AM

              Bob,
              Thanks for your help; the suggestion is now entered in Jira (http://svn.modxcms.com/jira/browse/MODX-1637).

              I must admit I dislike sending the user(editor) back to the form; what if (s)he wanted exactly what (s)he asked?
              I prefer the MODx manager to make an educated guess about what the user wanted to accomplish (and that will almost never be: have two resources with the same menuindex) - and take action accordingly.


              It would be unusual for MODx to do a user’s thinking for them, but it could certainly work that way. OTOH, it could also say "Warning: Duplicate menu index. Continue with save?" with Yes/No buttons.

              My guess (and that’s all it is) is that this won’t be a part of the MODx core, which is intended to be lean and mean wherever possible so it would have to be developed as a plugin.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 3496
                • 101 Posts
                It would be unusual for MODx to do a user’s thinking for them, but it could certainly work that way. OTOH, it could also say "Warning: Duplicate menu index. Continue with save?" with Yes/No buttons.
                Yeah, that could work.

                My guess (and that’s all it is) is that this won’t be a part of the MODx core, which is intended to be lean and mean wherever possible so it would have to be developed as a plugin.
                Ok, clear, but I must admit that I’m not even sure I would download that plugin - I’m now very conscious of the issue, so it will in practice not be a problem for me anumore - but it could be an issue for new MODx users.
                  • 3749
                  • 24,544 Posts
                  FWIW, I do the menu on paper and number the menuindex by 10 (10, 20, 30, etc) so there’s room to insert new ones. If you plan to do a lot of inserting, you could number them by 25, 50, or even 100. I always give the "Contact" page a menu index of 9999 because I always want it last.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 3496
                    • 101 Posts
                    Right; the experienced users will not have a problem - and as Shaun pointed out in Jira, in Revolution drag and drop of the pages works fine (and causes automatic renumbering).