Jump to content
psy

[solved] Problems with template export/import

Recommended Posts

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By NorbertH
      As we are building some webapplications with the PW backend , having those really big spacings between all field elements in forms and everywhere is not too practical. 
      UI Kit already has less spacings between all elements than Bootstrap for example , but i am looking fore a more condensed BE Theme.  Maybe someone already made something like that?
    • By VeiJari
      Hello, our customer doesn't like the fact that they have to first add a title and then add the other info in the form. Therefore, we've enabled the way to skip this by making a temporary file before saving.
      But the problem is that by using module schedulepages in this piece of code in the module:  
      if (!$page->isNew() && $page->publishable() && $page->isChanged('status') && $page->is(Page::statusUnpublished) && $page->publish_from) {
                  $this->session->error($this->_("“Publish From Date” field was cleared to prevent the page from being unintentionally re-published on the next Lazy Cron run."));
                  $page->publish_from = null;
                  $page->save('publish_from');
              }
      it fires even with the temporary file and therefore after first save it resets the publish_from field. Is there a way to check if template is temporary, or something along those lines?
      One solution is just to ask the customer to first save the form after adding a title, but I don't see that as a good solution.
    • By angelo, italy
      Hi guys... I love pw!
      I'm trying to update a template of the multilanguagge website. I created a field, i called it "headimage" and I added it to the home template. .. . But I can t see any image!!! Where is the issue??
      Thanks
      my friends
       
    • By JeevanisM
      Hi All,
      I am trying to build a PW website upon the  HTML design as shown here : https://bit.ly/2HxZbwr
      As you can see,  I use a repeated block to display a divider between sections on the page, its an image background-text on top. The screenshot is here :
      Now, I created a new field for this block content and attach that field to my Home Page template. But in HTML design, I used this block in two places, on on top side, and one on the footer. Now, when I do it in PW, can I use one same field multiple times in a single page template ? I have read this thread about using fields in efficient way, but I could not figure out, how to use same field multiple times in a page template.

      I hope I did not confused any one with my query, please let me know the correct PW way to achieve  this.
       
      thanks
      Jeevz
       
    • By louisstephens
      Hopefully this is the right place, if not, please move it to the proper sub. I installed the multi language module on my development (sandbox) set up not too long ago to test out a few things. From the start, I ran into some issues with dependencies not being met/installed, so I thought that I would simply just uninstall what had been. Unfortunately, that took me down a road of using some code in my home template to remove the modules (cant find it at the moment). After some struggling, I finally got it uninstalled, but it left behind 3 fields,
      language language_files language_files_site I thought that I could simply remove them from the languages template and then delete them, but I get the following error:

      I was wondering, is there a way to remove these using the api? I couldn't add any new users to the setup until I made "language" not required, but I was hoping to just remove all of the fields.
×
×
  • Create New...