psy

[solved] Problems with template export/import

Recommended Posts

Posted (edited)

I'm combining two PW sites into one, Site A into Site B.

At each step, I did it bit by bit as the 'all at once' approach failed.
 
First, I exported all the fields from Site A and imported into Site B. Any field types not supported by import/export, eg FieldtypeOptions I manually recreated. All good.

Next I exported all the templates from Site A and imported them into Site B and copied across their associated template files. All good.

Finally I exported the pages I needed from Site A into Site B - again, bit by bit to ensure it all went smoothly.

From the admin side, it all looked and worked perfectly.

Front end was a totally different story. All existing pages in Site B worked as expected. NONE of the pages imported from Site A displayed. They all ended in a redirect loop with no errors in the PW logs or Tracy Debugger.

After some trial-and-error, I finally got it working with:

- create a new template in Site B admin with no associated template file and just a title field
- import the fields from the imported Site A template into the newly created template (both on Site B)
- copy the Site A php template file into a new file that matched the new PW Site B template name and save in Site B site/templates

I can deal with the above workaround. Just curious to know if I did something wrong or if the template import/export feature is problematic?

 

### Solution:

While the export/import was a slow process, turned out the front end redirecting issue was unrelated. For reasons unknown, all templates marked as HTTPS only were the ones redirecting, ie all templates from Site A. Finally solved it by changing the $config->https to true in site/config.php

Now the pages display correctly as https whether the template forces the issue or not.

 

Edited by psy
Solved problem

Share this post


Link to post
Share on other sites

Which PW-version are Site A & Site B?

I have used fields & templates export & import a lot, but without ex-/importing pages.

I don't have had any issues so far with the templates ex-/import feature. Only if there are templates in family-children relation that need both imported together in a new site, it needs multiple import steps, as in the first run, the family settings can not be set because wether parent nor childrens are known in the system.

  • Like 1

Share this post


Link to post
Share on other sites

I'm not really supporting it anymore because there are too many new fieldtypes to keep up with, but I still find this https://github.com/adrianbj/ProcessMigrator much easier and more reliable than the built in approach. Be sure to use the backup option because I know there are a few situations where it can do some weird things.

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, horst said:

Which PW-version are Site A & Site B?

I have used fields & templates export & import a lot, but without ex-/importing pages.

I don't have had any issues so far with the templates ex-/import feature. Only if there are templates in family-children relation that need both imported together in a new site, it needs multiple import steps, as in the first run, the family settings can not be set because wether parent nor childrens are known in the system.

@horst Site A is 3.0.107 and Site B is 3.0.110, and yes, I encountered the parent/child issue which is why I did it step by step.

 

@adrian yes, the templates do have multiple field types, including some new ones including fieldset page. Maybe that's where the problem lay? Will take a look at ProcessMigrator next time. Thanks for the tip

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, psy said:

the templates do have multiple field types, including some new ones including fieldset page.

I think Migrator would need to be updated to support these - it might not be too hard because of the similarity to repeaters.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for all your suggestions. I've actually narrowed down the cause however don't know how to fix...

It's related to https. Both site htaccess files were set to https only. Site A templates were also set to https only. Site B templates defaulted to http or https. Site B was an older site upgraded from 3.0.25 to 3.0.110.

I can now get the imported fields/templates/pages in Site B working by setting the templates to http or https. This however raises another issue, ie all assets - images, forms, etc - are served as http and throw errors, and in the case of forms, don't show on the front end at all.

Will do more digging around the forums and if you know how to resolve, please do share

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By mjut
      Hello!
      I am trying to get some extra css-file into my admin templates. I managed to modify my admin.php to this:
      <?php namespace ProcessWire; require($config->paths->adminTemplates . 'controller.php'); echo "<link rel='stylesheet' type='text/css' href='" . $config->urls->templates . "css/admin.css'>"; By doing so, the css <link> is added to the very end of each parsed admin-html. (right AFTER the closing </body> tag.)
      That causes some trouble. e.g. the page tree is not displaying any more. Although, other pages are working - like the edit form of a page.
      My question: is there a correct way of adding my extra css to the admin area?
      Thanks for you help!
      Stephan
       
    • By karian
      I don't know why multiple instances (repeater_repeat_columns1, repeater_repeat_columns2, ...) of my repeater field are displayed inside Template field (see image).
      Is there a way to clean/reset it ?
       

    • By louisstephens
      I have a repeater with a text field where I would like to use hanna code (to make it easier on the user) so the user can define the action of a image that is in the repeater. For example:
      1. The image should have an external link:
      - the user can just type in the url
      2. The image, when clicked, should be printable (using print.js)
      - the user can just type [[print_image]]
      That works just fine, but I am running into an "issue". The code I need to use to print is:
      onclick="printJS({printable: 'path_to_image', type: 'image'});" I can put that into the hanna code as plain text, but I have no idea how to get the image from the repeater item and pass to "path_to_image". Is this even possible?
    • By Sten
      Hi,
      I have a lot of difficulties with getting a field value.
      First I created a template, inside I created several fields
      two fields are a dropdown select box So I have a value and a label for each line.
      Then I want to get the field value in _init.php or in the template to display it. How can I get the value of a field for the page ? I need to understand the flow through which data goes.
      Could someone help me ?
      Thank you