We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19872
    • 1,078 Posts
    I have maybe 20+ pages that I am trying to integrate from an older static site into a new MODx site. They all used the same template, will have same TVs filled out, and reside within the same container directory. I have my template built, and already manually create 2 or 3. Is there a way for me to create a CSV file maybe and post it right into the database?
    Would that be advisable? Would it take me longer to figure out how to do that, as opposed to just treading forward with the manual creation of these resources?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
        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
        • 19872
        • 1,078 Posts
        Excellent! Thanks Susan. I'll give this a go.
          • 42562
          • 1,145 Posts
          In Revo I use the native tool, in the top menu, Content -> Import HTML.
            TinymceWrapper: Complete back/frontend content solution.
            Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
            5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
            • 19872
            • 1,078 Posts
            Since I already have my template and TVs set up, I was thinking I could put data for additional pages into a CSV and post it to the database. Would using the native tool accomplish that?
              • 3749
              • 24,544 Posts
              I think it will, but you need to know the IDs of the TVs you're importing (and call the fields tv3, tv5 etc. -- where the number is the ID of the TV. I'm pretty sure the TVs must already exist.

              You can do pretty much the same thing with code like this if you'd rather roll your own:

              $fields['content'] = $content;
              $fields['pagetitle'] = $pagetitle;
              $fields['template'] = $template;
              // etc.
              
              $fields['tv1'] = $tv1;
              $fields['tv6'] = $tv6;
              // etc.
              
              $modx->runProcessor('resource/create', $fields);
                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
                • 19872
                • 1,078 Posts
                Thanks Bob:
                This is what I was thinking. Importx that Susan suggestion also looks promising. At the moment, I'm tediously collecting all the bits of content I want to import for each resource.