Importing template tables into new installation

I have a site on 2.8.3 that was built several years ago with a theme. This theme came with a bunch of functionality, so custom templates, tv, chunks, styles and a ton of extras.

We want to upgrade this site to 3.0 but several of the extras are not compatible with 3.0. Our first attempt to upgrade resulted in a LOT of red box error messages. Several extras are not compatible with 3.0, one in particular is Blogit that is used for a few hundred blog posts. Plus there is a lot from the theme we don’t want or need.

There are a couple hundred blog entries and a bunch of other resources that would take a long time to manually cut and paste to a new installation.

So our approach is to install collections on a new Modx 3.0 installation, export the site content tables, template variables, categories, templates and all the collections tables from the current site, then import them into the new installation–which we’ve done.

So now all the standard resources, all the collections resources show up in the new resource tree and template variables, template variable values and categories all appear correctly in the new installation. Yeah!

All except the templates.

The template categories appear in the tree with the triangle, but when we expand the category to show the templates, there are none. I’ve confirmed that templates are in the new database. Also if I try to create a new template, I get “an error occurred” in a dialogue box.

The templates appear to function as assigned to the various resources because if I edit a resource the appropriate TVs appear on the resource with the values as assigned.

If we can fix these templates, we should be able to rebuild the rest fairly quickly by installing the required extras, copying the chunks, style sheets, etc. without having to recreate hundreds of resources.

Is there a way to fix the templates?
Could there be differences in the DB table that just won’t work?

So does this approach even make sense? Is there another approach we should consider?

Any suggestions are appreciated.

Thank you!

Did you import the database table structures from 2.8.3 as well as the data?

The site_templates table has a new column preview_file in 3.x so you’d need to just drop the data into it.

maybe try to copy your tables to a fresh 2.8.3 installation and upgrade to 3 from there

1 Like


When I look at the table structure I don’t see a preview_file column. There are 14 columns in both 2.8 and 3.0 in site_templates.


I like your idea. I think I’ll give that a quick test. Thanks.

If I still have issues with the templates in 2.8.3, I’m back to original issue.

Sounds like you’ve overwritten the table structures.

You could just add in the preview_file column on the fly as a test - but @bruno17 suggestion should be more comprehensive and should catch any other discrepancies.

Let us know how you get on!

OK. I installed a new copy of modx 2.8.6 (I figured it was close enough to 2.8.3). Then I imported the site_templates table from the 2.8.3 of the live site into this new 2.8.6.

At first the templates didn’t show up.

Then I imported the categories table and there they are!

I think we are good to go.

Thank you so much for the help!

1 Like

OK, I’m back. . . .

Collections is failing.

So I wiped out my 2.8.6 version and started over with 2.8.3 (which is what the original site is at). Then, because I want to document my process while still on my test server, I did this:

Install Modx 2.8.3
Install Collections & Get Resources
Export collections tables from original site
Export templates, categories, category closures, content and tempvars tables from original
Import all tables into new site

The frontend of all resources are working.
The manager is working except collections.
I can create new templates, chunks, settings etc.
I can edit resources except for the home page (I presume this is unrelated) and the collections container page.

I can view the frontend of the collections page, but in the manager editing either results in a 500 error. I can quick the collections container.

I’ve uninstalled (not removed) and reinstalled collections.
I’ve changed template on the collections resource
I’ve commented out chunks that have not yet been copied over (just header/footer chunks, getResources calls, etc.)

I can’t find an error messages that seem related. There’s nothing in the modx manager log after the errors. The server has several modx installations (for testing) in separate folders. The error logs have minor items related to the other installations but none that seem related to this one.

The developer tools console is not helpful:

Failed to load resource: the server responded with a status of 500 ()

I thought this approach would work since I previously imported those tables and collections was working. I can’t figure out what is different this time.

Just as I was writing this up, I checked on more thing:

Collections Views in the extras dropdown. There are none. On the original site there is a view called blog that uses a blogit template as the default template. This blogit template is in the tree and seems ok.

I tried to create a view, but there are no templates in the dropdown to choose from and it won’t let me insert one. I checked the DB table (modx_collection_templates) and it does contain the that default template from the original site.

I also checked the collections sytem settings. They are identical to the original site.

Edit. The server is running PHP 7.4

I know this is getting down into the weeds here, but we’re sooo close.


I’m taking another look at the Collections View. It should show the default template but the list is empty. This is how it looks on the original site.


This is how it looks on the new site. Dev Tools Console shows that the connecter.php file is not loading. Even though the file is actually there.

I though perhaps the file might be corrupted or have incorrect permsions so I removed the file and reinstalled collections from the grid and the file reappeard, but it is still not recognized.

The template referenced is in the collections templates table. It won’t let me add a view because the template dropdown doesn’t load.

I thought I could add a view directly to the DB, but I can’t find where it’s coming from.

Any ideas?

Did you actually check the file permissions?
As you get a 404 status code, is the path MODX tries to load really correct? Maybe there is a problem with (for example) the base_url.
Also maybe check the .htaccess file to make sure everything is correct there.

I believe they are in the database table modx_collection_templates.


Good call on the base_url. It was pointing to the original site. I’ve corrected that. But nothing has changed.

There is no .htaccess in the directory for this site.

I do see the template in the modx_collection_templates table, but it not loading when I open the collections view in the extras dropdown and if I try to add a new template, the default template field dropdown just spins and never loads the list of templates. (I’m assuming it needs the connector.php).

The permissions on the connector.php file is 0644.

Might there be something in the tables I copied over that might affect this? (templates, categories, category closures, content and tempvars tables). I think I may have to test this by installing a new 2.8.3 and then collections to confirm its working before bringing over all the tables.

Collections and getResources were originally loaded by/with installation of Blogit. Might there be something missing here because I installed Collections independently?

Might there be some other tables that have to be copied over from the original site?

Still working on this. Going back to basics/beginning.

–Wiped out the modx installation and installed new using a new folder, database and db user.
–Installed collections.
–Created a new resource in the tree with a document type of Collections
–Click on new resource, the collections grid appears with the dropdowns to create a child document, quick create child and bulk actions.
–Hover over dropdown, nothing happens (it should highlight and open dropdown on click)

Dev tools console shows connector.php not found (404). I’ve verified the path and the file is there with permissions 0644.

I don’t know how to get past this.

The weird thing is, that you should only get a 404 error code, if the connector file doesn’t exist. If there is something wrong with the code in the connector file, then the status code would be different.

  • If you create a test file in the same folder (with the same permissions), can you request that? Can you request other files in the “assets” folder?
  • When you open the “Network” tab of the developer tools, before loading the combobox content, what is shown there?

Thanks halftrainedharry for getting back to me.

  • If you create a test file in the same folder (with the same permissions), can you request that? Can you request other files in the “assets” folder?

When I put the url in a browser I can open:


and this one: assets/components/collections/index.htm (which is blank)

I created a text file and it opens as well:

The connector.php does not open.

I renamed the test.txt to test.php and the file does not open.

  • When you open the “Network” tab of the developer tools, before loading the combobox content, what is shown there?

When I go to the manager dashboard the console shows this which is consistent with other sites on the manager.

Error with Permissions-Policy header: Origin trial controlled feature not enabled: ‘attribution-reporting’.
Error with Permissions-Policy header: Origin trial controlled feature not enabled: ‘run-ad-auction’.
Error with Permissions-Policy header: Origin trial controlled feature not enabled: ‘join-ad-interest-group’.
Error with Permissions-Policy header: Origin trial controlled feature not enabled: ‘browsing-topics’.

Then when I click on the collections resource or the extras dropdown for collections views the 404 error appears and the manager header/menus is gone.

All these folders have permissions of 755


The fact that the test.php doesn’t open feels like a clue to me, but I have no idea what to do with it.

Thank you!

What exactly do you mean by “does not open”? Do you also get a “404 Not found” status code? Did you change the content to some PHP code like e.g.

echo "test";


Yes, 404 on those files. It takes me to the 404 page on the site and the console shows 404.

I just updated the content of the php file as you suggested. It also came back with 404.

OK, I think we’ve gone down this rabbit hole far enough.

We installed collections onto another existing site on another server with no issues The only other thing I can think of is that my test site were setup in a folder next to another site not the root of the server. This existing site was installed in the root folder.

So perhaps there’s something about this environment that is an issue or modx being in a folder along another site.

In any event, I think we’re going to proceed with a new server with a clean install in the root folder and go from there.

I appreciate all your help–and patience!

Thank you!