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.