Accessibility

TechNote (Archived)

How to make an inherited editable region uneditable

Introduction
When working with a nested template in Dreamweaver MX, the editable regions from the main template (the base template) will remain editable in the nested template and in instances of the nested template.

A developer may wish to "lock" all or part of an editable region, and prevent the editability from passing through to the instances of the nested template. The editable region would remain editable in the nested template itself, but it or part of it would be uneditable in pages based on the nested template. The method for doing this will differ depending on whether the developer wants to lock the entire editable region orpart of the editable region.

Prerequisites
Readers should be familiar with the concept of nested templates. In addition to the Help directory (Help > Using Dreamweaver, then navigate to Working with Multiple Pages > Managing Site Assets, Libraries, and Templates > About Nested Templates), see theAdditional information section.

How to lock part of an editable region
If a developer adds a new editable region while in the nested template, the original editable region which contains the new editable region will be locked in instances of the nested template.

In the figure below, the editable regions called EditRegion1 and EditRegion2 are from the main template. EditRegion3 was added in the nested template. Since EditRegion3 was added in the nested template to an editable region (EditRegion2) already available from the main template, EditRegion2 will not be editable in the instances of the nested template.

Note:The yellow tab of EditRegion2 indicates that region is not editable.

1 Create a template that will act as the main or base template and save it as a template (File > Save as Template).
2

Define at least one editable region in this base template, using either of these two methods:

Insert > Template Objects > Editable Region
This will create an empty editable region into which you can add content. This is the most useful method if you are starting with a blank page.

Highlight the item or the tag you wish to be editable, then choose Insert > Template Objects > Editable Region
This will make editable only the object or tag you have selected. This is the most useful method if you are starting with an already-designed page.

3 Save this document (File> Save).
4

Create a new document based on this template (File > New, then from the Templates tab, choose the site in which the template was saved and choose the template).

5

Save this new document as a template (File > Save as Template). This document is now the nested template.

6 Within the nested template, repeat step 2 to define a new editable region within an existing editable region. Once you do this, you will notice that the outer editable region's tab has become yellow, just as in the screen shot above.
Any documents made from this nested template will be able to access the inner editable region, but the outer editable region will be locked.

How to lock an entire editable region
In the screen shot above, EditRegion1 passes through to instances of the nested template. A document made from the nested template will still be able to edit that region. To make an editable region completely locked to a nested instance, use the method below.

Making the region uneditable, and retaining the visibility of its content while in the nested template
1 Create a template that will act as the main or base template and save it as a template (File > Save as Template).
2

Define at least one editable region in this base template, using either of these two methods:

Insert > Template Objects > Editable Region
This will create an empty editable region into which you can add content. This is the most useful method if you are starting with a blank page.

Highlight the item or the tag you wish to be editable, then choose Insert > Template Objects > Editable Region
This will make editable only the object or tag you have selected. This is the most useful method if you are starting with an already-designed page.

3 Save this document (File> Save).
4

Create a new document based on this template (File > New, then from the Templates tab, choose the site in which the template was saved and choose the template).

5

Save this new document as a template (File > Save as Template). This document is now the nested template.

6 Within the nested template, locate in the code the editable region from the base template you wish to lock. An easy way to do this is to select the editable region's tab in the Design window, then View > Code. The entire editable region will be highlighted in Code view.
7 Add the following code to the editable region code:
ÂÂ@@("")@@

Note: This template code can be placed anywhere within the <!-- InstanceBeginEditable --><!-- InstanceEndEditable --> tags.

As an example, the code for the figure above would change from:

ÂÂ<!-- InstanceBeginEditable name="EditRegion1" -->
ÂÂ<p>Editable 1 </p>
ÂÂ<!-- InstanceEndEditable -->

to (new code in red):

ÂÂ<!-- InstanceBeginEditable name="EditRegion1" -->
ÂÂ<p>@@("")@@ Editable 1 </p>
ÂÂ<!-- InstanceEndEditable -->

Note: There is an error in the Dreamweaver documentation on this point. The code mentioned in the Help Pages is incorrect. It omits the parentheses surrounding the double quotes.

Once this code is added to the editable region, the tab for editable region will turn orange, and the editable region will display the expression icon. Note that the content will remain fully visible and fully editable while in the nested template.

Making the region uneditable, but controlling the visibility of its content while in the nested template
By simply modifying or moving code within this editable region, developers can control whether pieces of code are visible or hidden.

1 Follow the steps mentioned above, including adding the code.

The code above would change from:

ÂÂ<!-- InstanceBeginEditable name="EditRegion1" -->
ÂÂ<p>@@("")@@ Editable 1 </p>
ÂÂ<!-- InstanceEndEditable -->

to (new code in red):

ÂÂ<!-- InstanceBeginEditable name="EditRegion1" -->
ÂÂ<p>@@("Editable")@@ 1 </p>
ÂÂ<!-- InstanceEndEditable -->

Since part of the original content has been moved into the quotes, that part is no longer visible within the nested template. This can be used for any piece of codeâ”text, a table, or an imageâ”just as long as the rules of nesting are followed.
Note: The content will still display fully in pages based on the nested template.

Additional information

Creating a nested template in Dreamweaver MX (TechNote #16282)
New template features in Dreamweaver MX (TechNote #16347)


AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support


Document Details

ID:tn_16416

Products Affected: