Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Switching Templates and Keeping or Copying the Text View modes: 
User avatar
Member
Member
scott_hancock-urmc.rochester - 7/29/2011 9:40:00 AM
   
Switching Templates and Keeping or Copying the Text
I need to switch a large number of pages (50+) from one template to another. Obviously when I switch templates, I will lose any text in the editable text web parts. I know that if I switch the page back to the original template the text will still be there. Is there any way to point the editable web part in the new template to the text in the old template or copy the text to it?


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 8/1/2011 5:01:33 AM
   
RE:Switching Templates and Keeping or Copying the Text
Hi,

the content of editable text web part is separated from the template. The connection is GUID of editable text web part. So you could replace the GUID of editable text web part on a new template, i.e. in properties of zone, Web parts tab. The old one GUID (guid of editable text web part from the original template), you can find in Web parts tab as well or in properties of web part (on the top is a link and GUID is its part).

Best regards,
Ivana Tomanickova

User avatar
Member
Member
scott_hancock-urmc.rochester - 8/5/2011 1:02:50 PM
   
RE:Switching Templates and Keeping or Copying the Text
Hi,

It works, thank you! I've listed the steps I took below to help others. If there is a better way, let me know.

1. Create a new page and use the template "Header and text with left menu".
2. Enter some text into the editable text area called ContentText and save.
3. View the document and see that the text is there.
4. Go to the page's properties tab and click on Template
5. Click "Edit template properties"
6. Click the Web Parts tab.
7. Find the section for the editable text webpart. controlid="ContentText" type="editabletext"
8. Copy the GUID of the web part.
9. Close the properties window.
10. Back at the Template tab of the page's properties change the template to "Header, text region" and save.
11. View the page. The text is not there.
12. Go to the page's properties tab and click on Template
13. Click "Edit template properties"
14. Click the Web Parts tab.
15. Find the section for the editable text webpart. controlid="MainRegion" type="editabletext"
16. Change the GUID of the webpart to the one you copied from the first template.
17. Click OK and close the window.
18. Click Save.
19. Now view the page and you should see your text again.

Scott


User avatar
Member
Member
scott_hancock-urmc.rochester - 9/2/2011 9:05:55 AM
   
RE:Switching Templates and Keeping or Copying the Text
One important thing to remember is that since you are changing the template this, will affect all the other pages using that template.

So if you are switching to a new template it's no problem but if you want to switch to an existing template you will change the text on all the pages currently using that template to the text on your page.

In my case then, this won't work for me.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 9/4/2011 2:45:30 AM
   
RE:Switching Templates and Keeping or Copying the Text
Hi,

I am sorry but maybe I am little bit confused. So, the steps described above changed the text in existing editable web part because you changed its GUID to the ID from the other template, right?

Have you tried adding another editable web part definition directly to the new page template you want to use without changing anything in the existing editable web part?

Best regards,
Juraj Ondrus