Joe Craig
Joe Craig

Reputation: 1264

Page import/export in DNN with 2sxc modules on pages

DNN 9.6.1 2sxc 11.2.0

I have a dev and production site that are (more or less) copies of one another.

I created a 2sxc app on the dev site and built some pages. I need to move the pages and the app to the production site.

  1. I exported the app from the dev site and imported it into the production site with no problems.
  2. I exported (with content) pages containing the app from the dev site, and then transferred the page templates to the production site.
  3. I then created new pages on the production site specifying the appropriate template for the page.
  4. The new page(s) get created, with 2sxc apps in the correct places, but I get messages on the screen saying that the data hasn't been initialize or is empty.
  5. I can delete the app, add a new app, specify the app template and manually add the data (that came over with the app) and all is fine. Except that this is a pain having to manually re-create lists of content items.

If I use an page template exported on the dev site to create a new page page on the dev site, the new page is created perfectly.

So, I think that this is a problem with the app export/import process.

Upvotes: 0

Views: 266

Answers (2)

iJungleBoy
iJungleBoy

Reputation: 5638

The solution I gave Joe is this

Basics

So before we start, I need to make sure you understand the core concepts which differentiate data from content.

  1. Data is just data - your code can sort it etc. and just work with it like records
  2. Content is data which was manually placed on a page, in the order the content-editor wanted it in. This bundle of items and their order is stored in a ContentBlock

Now before we continue, I recommend you read https://docs.2sxc.org/specs/content/index.html and https://docs.2sxc.org/specs/content/dnn-integration.html which explain how DNN modules point to a content block.

Your Issue Re-Explained

From what I understand I believe that your setup is using content.

  1. So in your source system DNN1 you had a module M1 pointing to an App A1 containing a ContentBlock CB1.
  2. You then exported A1 - probably without checking "include ContentBlocks" in the App-Export, which would include CB1
  3. reimported it on DNN2.
  4. You created a new Module M2 - this doesn't have a content block yet, so it created a new one CB2.
  5. Now you were stuck with manually recreating the list of items in the new CB2

Is that about right?

Understanding Site Export-Import

If you are migrating a site, then you would export the site-template which would still include M1. M1 would still point to App1 and CB1 but wouldn't find it - and you would then see a message that it couldn't find it yet. In this scenario, you would then export A1 with the checkbox to include ContentBlocks and import it in DNN2 - and everything magically works. This is also explained here: https://2sxc.org/en/learn/copy-duplicate-an-entire-site

Using this for your own setup

If you plan on doing this export/import of the app multiple times, I suggest that you

  1. First of all always export the app with the ContentBlocks included.
  2. On DNN2 add an M2 (which creates a CB2-refence) and then manually go to the DNN sql table and replace the ModuleSetting of this new module to point to the original (now re-imported) content-block CB1. This is a GUID that you could look up on the source system.

Once you do this, re-importing the app many times will always point to that original CB1, and everything should work ;)

@joe best mark as fixed

Upvotes: 1

Joe Craig
Joe Craig

Reputation: 1264

When exporting the pages, I should have checked the first checkbox: Include all content groups.

(Thanks Daniel Mettler!)

Upvotes: 1

Related Questions