We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38310
    • 23 Posts
    I have two sites build with Modx1.04, both of them were about tourist but diffent area.
    Now I want add the same content to one site from another site, can I just import the database?
    Does you guys have the experience or have some adivce?
    Thanks very much!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      No, you can't just import the database, as that will cause conflicts with the resource and element IDs; both sites probably have a resource with ID #1, for example.

      Another complication is that TVs are connected to resources by their ID; so if you have a resource #10 with a TV in site B, and insert that resource into site A with a new ID since it can't have the ID of 10, its TV won't know what it is.

      So I am not aware of any simple way to do this.
        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
        • 38310
        • 23 Posts
        Quote from: sottwell at Nov 27, 2012, 10:49 AM
        No, you can't just import the database, as that will cause conflicts with the resource and element IDs; both sites probably have a resource with ID #1, for example.

        Another complication is that TVs are connected to resources by their ID; so if you have a resource #10 with a TV in site B, and insert that resource into site A with a new ID since it can't have the ID of 10, its TV won't know what it is.

        So I am not aware of any simple way to do this.
        Yeah, I have also notice that through check the modex database.
        So now I just create the same documents and fill them one by one.
        Thank you all the same!:)
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          If you have a lot of resource, hundreds for example, it might be worth your while to write a custom script to fetch the resources from site A, then process them one-at-a-time to insert them into site B's site_content table, get the insert ID (the auto-increment ID) then identify its TVs, fetch its TV value from the site_tmplvar_contentvalues, identify the corresponding TV on site B and insert the IDs and value into site B's site_templvar_contentvalues table.

          Then if your pages are private, you have group assignments to consider. That would also have to be part of the resource-transfer script; much in the same manner as the TV values.

          A bit tedious to set up, but it's do-able.
            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
            • 38310
            • 23 Posts
            Sorry to later reply, I also think your idea is workable but complex and come with dangerous.

            And now the reqirment is not just copy but modify some of the database.

            So I just select the foolish way to get this done.

            Thanks! smiley