Batch Apply Template!
Your web site needs to be updated by having a new template applied to it and you want to do this as painlessly as possible, preferably as a batch routine.
But there's bad news - there is no easy answer to do this because there are the following variables that need to be considered:
The Variables:
- Is the original site already controlled by a template or templates?
- Do the new template and the old template contain exactly the same number of editable regions?
- Do the new template's and the old template's editable regions have exactly the same names?
When it can't be done!
You have to use the method outlined in the Static to Template Conversion tutorial if your site is not currently associated with a template OR your templates do not match number and name of the editable regions.
When it can be done!
You can apply a new template to your entire site with the procedure outlined below, if your site is already associated to a template AND the number and names of the editable regions are identical.
Swapping the template in use:
- Build your new template making sure to use the exact same quantity and names of the editable regions (in fact, all regions).
- Perform a site backup! (Just in case there are any inconsistencies encountered)
- Open an existing child page. In this child page, near the top of
the document will be a line similar to this one:
<!-- InstanceBegin template="/Templates/OldTemplate.dwt.cfm" - Copy this to the clipboard and close the open document.
- Select Edit > Find and Replace...
- In the Find dialog box, complete the following fields:
Find In: Entire Current Local Site
Search For list: Source Code
Search For Field: <!-- InstanceBegin template="/Templates/OldTemplate.dwt"
Replace With field: <!-- InstanceBegin template="/Templates/NewTemplate.dwt"
Click the Replace All button. - A warning dialog opens advising that changes will not be able to be undone, click the OK button
- The reports panel opens and advises which pages were modified.
- Open the NewTemplate.dwt file and add a space to a non-editable region (that's so the DMX template engine will regard the new template as having been changed).
- Save the changes and update the site.
- Remove the added non-editable region space, save changes and update the site again.
- Check your site locally to make sure the changes took effect and you're done.
- Upload the changed files to the server.
You've just successfully converted your site from one template to another with minimal hassle. Congratulations.