We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53932
    • 33 Posts
    Hi, what's the fix for the below scenario?
    For example, if we duplicate resource ID#5 and its children (6-10), the new resource tree has resource #11 with children #12-16. But if #5 contained a hard-coded link to #6, #11 will contain the same hard-coded link to #6, when we really want it to link to #12.
    Hope to see the answers for it. TIA.
      • 4172
      • 5,888 Posts
      Can you tell more about your scenario. For which reason do you duplicate resource-trees?
      Can't you make this hardcoded links dynamic-links, somehow?

      Kind of, like Babel it does?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 53932
        • 33 Posts
        Here are the details about my scenario:

        Duplicating the folder and it's children. So the hardcoded page links (eg:[[~1234]]) in the content of old folder are mapping respectively to old folder. So when the content is copied over to new folder, the hardcoded links in the new children should map appropriately to new folder. How that mapping works in MODX?
          • 4172
          • 5,888 Posts
          hmmm, still, I don't understand why you have hardcoded Links and how MODX should translate them after duplicating this resources.
          Is there some kind of rule, for example do the duplicates have the same alias?
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 53932
            • 33 Posts
            Excuse me for not being more clear. we have parent folder containing different versions(eg: 1.1, 1.2, 1.3, etc., as children and sub folders as actual pages) under each user guide. So creating a new version by copying/duplicate the old version at children folder level (which takes care of copying the sub folders/the actual pages).

            Actual problem is: "content" has some hard coded links to pages of old version as shown below in a "Document".

            <ul>
            <li><a href="[[~6]]">Page Title 1</a></li>
            <li><a href="[[~7]]">Page Title 2</a></li>
            </ul>

            we want to automatically update the links to point to the similar pages in the new version.

            Is there way to do this?
              • 4172
              • 5,888 Posts
              while this might be possible with a custom-coded plugin, that runs at OnResourceDuplicate, I would try to avoid hardcoded links at all, in a setup like that.
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 4172
                • 5,888 Posts
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 53932
                  • 33 Posts
                  Thanks for the quick replies Bruno. I'm going for the custom coding at this point.
                    • 3749
                    • 24,544 Posts
                    You could use Wayfinder to display links to the children.
                      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