Design and CSS styles
Version 3.x > Design and CSS styles > Beware of global template gochas View modes: 
User avatar
Member
Member
mcutter-global-id-group - 10/21/2008 4:41:46 PM
   
Beware of global template gochas
Global templates are global to all sites in the database. Unlike desktop applications like powerpoint or word, when you create a new site it does not make a local copy of the templates. It actually uses the gloabal template. Any changes to the new site will change all previous sites that happen to use the same template.

What this means is that if you have two portal sites that both use the topLogo_topMenu master template, and you add a toplogo image using an image tag in the template of one site, then it will show up in the other site as well.

This applies to website templates as well. If you create a new site from a website template and then change the layout of any templates in the new site, it will change in the template site as well as all sites previously based on that template!

This applies to import/export as well. Say you are planning a major overhaul to a website so you export the current version of the site, make extensive changes, and then put the new site into production. Then someone comes along and wants to see the old site side-by-side with the new site. If you import the old site it will overwrite all of your template changes!!

This applies to adhoc templates as well! Adhoc templates are NOT locally unique templates. They are simply names that are initially generated as globally unique. If you think that by using adhoc names you will be protected, you are wrong. Try creating a site using adhoc names. Then export that site as you would for a backup or set it as a website template. If you create a new site from the backup or based on the template and change the template layout it will change the original and any other sites that use the same adhoc names!

We have adopted the following methodology to keep from running into these kinds of problems.
1. Create a new site from an existing template site or import, eg. named NewSite.
2. Save the master template with the name newsite_<templateName>, e.g. newsite_topLogo_topMenu. If this is a new version of an existing site and has changes to the template then add a version number or date to the name to make it unique, e.g. newsite2008-10-15_<templateName>
3. Save each unique page template with the same newsite_ naming convention.
4. Go into SiteManager and only make the newsite_ templates available to newsite.
5. Add pages and content to newsite.

It is important to setup unique names for a site upfront because once a site has been populated with content you will lose all the content if you change the page template. Actually, the content is not lost, it is just orphaned. The next release is supposed to have a way to retrieve orphaned content.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 10/22/2008 2:03:51 AM
   
RE:Beware of global template gochas
Hi Mark,

Thank you for you detailed description. I think it will be very helpful. I would like only to post this link to our knowledge base:

http://devnet.kentico.com/Knowledge-Base/Design-and-css/Page-templates.aspx

Moreover, in our documentation it is recommended, when creating custom templates, web sites, etc. to create unique (or custom) changes to avoid the problems you have mentioned (for obvious reasons) and also to avoid the changes by future upgrade where the defaults are overwritten.

Best Regards,
Juraj Ondrus