Revert your MX template to DW/UD 4 format.
You may find yourself in a situation where you have upgraded to Dreamweaver MX and your colleagues have not, as yet, done so. If the scope of your project requires templates, and you want your subs to be able to use those templates, and since you're aware that the template markup has changed from DW4 to DMX, how can you design the template so that your subs can use them?
As it turns out, it can be done with the use of 4 find and replace queries and a little planning on your part as you develop the template. We could set up more queries to remove markup that is definitely not Dreamweaver/UltraDev 4 compliant, but that's where your planning comes in so we won't discuss it anymore.
What template markup cannot be reverse engineered?
Do not use the following template region types or markup:
- Optional Regions
- Editable Optional Regions
- Repeating Region
- Repeating Table
- Editable Tag Attribute
- Multiple If conditional
- Parameters
- Expressions
- Nested Templates
WARNING: If you did happen to use one or more of these region types, then please remove them prior to performing the template reverting routines outlined below.
Note: This restriction will eliminate your ability to take advantage of the new features of DMX templates.
Just what template markup can you use?
- Editable regions, period!
Ok, got it.... What's next?
The answer is quite short and the solution is easy to implement as long as you do each step in turn and only save the changes to the page when advised by this tutorial.
CAUTION: Do a site backup prior to performing this function.
Note: {space} represents a press of the spacebar.
At the bottom of this tutorial are a couple of downloads that are available for your use. The first is a set of Find & Replace queries; the second is a Dreamweaver MX site that you can practice with before you attempt this on your own site.
The Steps:
- Open the base template
- Perform the following find/replace (This document only and Source Code):
This is the query named: To_DW4_ER_End.dwr
Find:
<!-- TemplateEndEditable
Replace:
<!-- #EndEditable
Note: DO NOT SAVE YET!
Click the Replace All button and a warning box opens stating: This operation cannot be undone in documents that are not currently open. Are you sure you want to replace all matches? [Yes] [No] Select the Yes button. - Perform the following find/replace (This document only and Source Code):
This is the query named: To_DW4_ER_Start.dwr
Find:
<!-- TemplateBeginEditable name=
Replace:
<!-- #BeginEditable{space}
Click the Replace All button and a warning box opens stating: This operation cannot be undone in documents that are not currently open. Are you sure you want to replace all matches? [Yes] [No] Select the Yes button. - Save the changes and update the site.
- Close the template.
The remaining steps MUST be performed with all pages closed or errors could result. - Perform the following find/replace (Entire Current Local Site and Source Code):
This is the query named: To_DW4_Instance_End.dwr
Find:
<!-- InstanceEnd -->
Replace:
<!-- #EndTemplate -->
Click the Replace All button and a warning box opens stating: This operation cannot be undone in documents that are not currently open. Are you sure you want to replace all matches? [Yes] [No] Select the Yes button. - Perform the following find/replace (Entire Current Local Site, Source Code and make sure to check Use Regular Expressions):
This is the query named: To_DW4_Instance_Begin.dwr
Find:
Instance\w*\st\w*\W(\W\/\w*\W\w*\W\w*\W)\s\w*\W\W\w*\W
Replace:
#BeginTemplate $1
Click the Replace All button and a warning box opens stating: This operation cannot be undone in documents that are not currently open. Are you sure you want to replace all matches? [Yes] [No] Select the Yes button. - Upload changed files to the server.
What did we just do?
- Steps 1 through 5 change the base template's Dreamweaver MX style template markup to Dreamweaver 4 style template markup and updates the majority of the template markup in the child pages.
- Steps 6 through 8 affect the remainder of the site files that are children of the base template. We need to perform these extra steps because the template reference does not get reverted on the child pages even though the template markup is Dreamweaver 4 version (it is outside the <head> tag!).
At this point, your template is converted and its child pages should reflect the old template syntax. Your colleagues using Dreamweaver/UltraDev 4 should now be happy campers, although you shouldn't be because you are losing out on quite a bit of template flexibility that Dreamweaver MX offers.
One thing to note now that you have the template reverted. If you do any editing to the template with Dreamweaver MX, the line: <!-- DW6 --> is added after the opening template reference on the child pages. This is normal and will not affect your Dreamweaver 4 users in the slightest.
Downloads:
2 kb |
4 queries used in this tutorial (Extracts with folder named Queries). |
|
83 kb |
Test site to test the instructions prior to doing it live (Extracts with folder named Revert, which you should use as the site root when you create the site definition for this working site. |