We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18389
    • 169 Posts
    I have a duplicate resource of every page on my site. They have the same name and createdon etc, but, they use different templates.
    The first one I create for my "regular" site, and fill the content manually. The duplicate is for the iphone version, which has a Ditto call to pull the content from the first page automatically.

    I don’t want to have to do things twice, every time I create a new gallery or blog post.

    Is there a way to automate the creation of the duplicate upon creation of the original, without having to manually create a new resource and input the information in all of the fields?
      www.markojokic.com
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Sure. Use a plugin to load the duplicate page into the database; use the OnDocFormSave event. I think the POST will still be available to your plugin code.
        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
        • 18389
        • 169 Posts
        I cannot right that code myself, hehe.
        To further prove that, my next question may be totally uninformed:

        If I use the OnDocFormSave event, won’t that make a duplicate each time I edit and save the document in the future as well?
        What about a button or field that duplicates it when I am ready to dupe it?

        I was hoping somebody might have gotten this done before.
          www.markojokic.com