We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3633
    • 84 Posts
    I am trying to find out, how to change the document id, after a new resource has been saved. My resources document ids look like this: Home (1), Page 2 (47), Page 3 (82), and so on. I need them to be like this: Home (1), Page 2 (2), Page 3 (3), and so on. Is there a way to change the document id, without the resource being a container? Thanks in advance.
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: bluegum at Feb 04, 2010, 09:46 PM

      I am trying to find out, how to change the document id, after a new resource has been saved. My resources document ids look like this: Home (1), Page 2 (47), Page 3 (82), and so on. I need them to be like this: Home (1), Page 2 (2), Page 3 (3), and so on. Is there a way to change the document id, without the resource being a container? Thanks in advance.
      Document id’s are determined by the database engine and are immutable. If you know all the data relationships, you can try updating the record and all the related records manually in the database, but we definitely do not recommend it.
        • 40452
        • 10 Posts
        best to use *menuindex and have your resources grouped that way you have control of your resources order.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Each resource and each element is given a unique ID on creation, and this ID is used internally by MODx for the lifetime of the object. Since many internal references are made to these IDs, it's not a good idea to change them. Just as one example, TV content is stored by TV ID and resource ID.

          The resource ID order in the Tree doesn't matter at all; there are other ways to sort them. Basically, you just ignore the ID unless you need it for some reason (such as generating a URL).
            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
            • 3749
            • 24,544 Posts
            If you tell us why you need those IDs set like that, we might be able to suggest a better way of handling things.

            and ....

            ------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using.
            MODX info for everyone: http://bobsguides.com/modx.html
              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
              • 40447
              • 165 Posts
              If you want to have your resources in the site tree in the same order as the pages on your website, then use menu index in Edit Resource to do that.
              Brian.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                If you're using Revo, you can drag-and-drop them into the order you want in the Tree. If you're using Evo, you can use the DocManager module and drag-and-drop them into order within the same branch.
                  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
                  • 47460
                  • 1 Posts
                  Hello!
                  I'm also interested in changing the id's.
                  I know why it's a bad idea but I still need to do it.
                  I'm remaking a site from evo to revo. As the initial site has tons of [~id~] links I'm simply recreating in revo structure all the documents in the order they were input in the initial site.
                  The bad thing is that at one moment I've deleted a page and now all the new pages are generated with id+1 compared to what I need.
                  I can change the id directly in the modx_site_content table but any new page is again created with id+1 compared to what I expect.
                  Any idea on how I can solve this? Is there some "counter" I can reste in DB?

                  Thank you!
                    • 4172
                    • 5,888 Posts
                    If you realy know what you are doing!

                    You can change the auto_increment for the site_content - table within phpMyAdmin

                    But, there are ways to import all of your resources,templates,chunks (with auto-converting MODX-tags) from EVO to Revo
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!