We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19833
    • 25 Posts
    It’d be nice to have some sort of feature that lets me export snippets, chunks, templates and TVs to a file and then import them if needed.
      • 3749
      • 24,544 Posts
      There are various ways to do something like this. Can you give a little more information about what you’d like to do and why?

      It’s not clear if you mean all the chunks & snippets together or individual ones, and if you want to import back to the same site or to a different one.

      Are you just wanting to back up your chunks & snippets, or do you need a selective export/import.

      Bob
        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
        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: mlchai at Feb 03, 2008, 02:38 PM

        It’d be nice to have some sort of feature that lets me export snippets, chunks, templates and TVs to a file and then import them if needed.
        This capability is part of the upcoming major release, known around here as 0.9.7. The feature is called Transport Packaging, and it will allow you to create zip files of any data objects (representing table rows) from your MODx site (i.e. snippets, chunks, pages, TVs, etc.) that can be exported and imported into other sites very easily. In addition, the transport carries with it a manifest which describes the order in which objects are installed, will allow various kinds of pre-insert validation and post-insert resolution scripts to be included that will be executed on install, will allow physical files to be related to a data object and transported/installed along with them, and will eventually allow developers to host their own package install/update sites for add-ons and core extensions.

        Currently though, your best bet is to export the rows in your database using MySQL’s complete and extended insert options, then edit the results to remove the id column and values from the insert statements (alternatively: you can select all columns but the id column in a SQL statement to export the data you want without having to edit the exported data/file). With this done, you have a little more portable representation of the data you want to import, or at least by inserting records without specifying the id, you won’t overwrite records in the target site that might already have the same id. However, keep in mind that if you are exporting stuff that relies on specific document id’s, or is related to other records (as is the case with TV’s), that can get a lot trickier, and that was the motivation for the upcoming Transport Packaging feature.
          • 19833
          • 25 Posts
          Oh, I didn’t know that. Well then, I’m looking forward to it. Keep up the good work guys. smiley