We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1095
    • 2 Posts
    Hiya

    My apologies if this has been answered somewhere. I’ve had a good look around and I can’t seem to see a simple answer to my question.

    I’m helping a friend migrate a site to modx. Part of the site contains 10 years worth of press releases. We’re looking at using the blog plugin for modx to display them. So I have thousands of press releases/articles to import. Each article has a date, title, content and a tag signifying who did the press release.

    Is anyone able to give me any tips as to the best way to import these articles into modx? I have good programming and database skills, so if someone is able to point me in the right direction I can probably figure it out! Is inserting straight into the database an option? There seems to be a lot of scary fields I’d need to have answers to. Would I be better off writing a script to interact with the modx web interface? I’ve read a little bit about @bindings... do I leave the data in its current database format and use @bindings to build my own template?

    I hope I’ve made some sense here wink Looking forward to any advice you can give!

    Thanks

    Alison
      • 29201
      • 239 Posts
      would like to bump this to see if anyone has a potential solution. i’m faced with a large import as well. thanks!~
        • 3749
        • 24,544 Posts
        What version of MODx?

        I would probably export the old DB to a comma-separated file and then write a script to parse that file and create the MODx objects.

        If you intend to have each post as a separate resource, you can skip most of the fields as their default values should be fine.

        You would probably want to set the pagetitle, alias, content, and menutitle fields and use the createdon field for the date. The only catch would be the createdby field (for the author) because it holds the ID of that user. You’d have to create the users first and then get the IDs using the usernames in order to set the field.

        If you have thousands of items, though, you might rather import the whole table into the MODx DB and create Tpl chunks and custom snippets to display it. You’d save the extra overhead of all the unused resource fields and the resource processing code.
          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