Links in templates – Adobe Dreamweaver CC 2015 User Manual
Page 475
468
Templates
Last updated 6/3/2015
An editable tag attribute
Lets you unlock a tag attribute in a template, so the attribute can be edited in a template-based
page. For example, you can “lock” which image appears in the document but let the template user set the alignment to
left, right, or center.
Links in templates
When you create a template file by saving an existing page as a template, the new template in the Templates folder, and
any links in the file are updated so that their document-relative paths are correct. Later, when you create a document
based on that template and save it, all the document-relative links are updated again to continue to point to the correct
files.
When you add a new document-relative link to a template file, it’s easy to enter the wrong path name if you type the
path into the link text box in the Property inspector. The correct path in a template file is the path from the Templates
folder to the linked document, not the path from the template-based document’s folder to the linked document. Ensure
that the correct paths for links exist by using either the folder icon or the Point-to-file icon in the Property inspector
when creating links in templates.
Dreamweaver 8.01 link update preference
Previous to Dreamweaver 8 (that is, Dreamweaver MX 2004 and earlier), Dreamweaver did not update links to files that
resided in the Templates folder. (For example, if you had a file called main.css in the Templates folder, and had written
href="main.css" as a link in the template file, Dreamweaver would not update this link when creating a template-based
page.)
Some users took advantage of the way Dreamweaver treated links to files in the Templates folder, and used this
inconsistency to create links that they intentionally did not want to update when creating template-based pages. For
example, if you are using Dreamweaver MX 2004, and have a site with different folders for different applications—
Dreamweaver, Flash, and Photoshop. Each product folder contains a template-based index.html page, and a unique
version of the main.css file at the same level. If the template file contains the document-relative link href="main.css" (a
link to a version of the main.css file in the Templates folder), and you want your template-based index.html pages also
to contain this link as written, you can create the template-based index.html pages without having to worry about
Dreamweaver updating those particular links. When Dreamweaver MX 2004 creates the template-based index.html
pages, the (un-updated) href="main.css" links refer to the main.css files that reside in the Dreamweaver, Flash, and
Photoshop folders, not to the main.css file that resides in the Templates folder.
In Dreamweaver 8, however, this behavior was changed so that all document-relative links are updated when creating
template-based pages, regardless of the apparent location of the linked files. In this scenario, Dreamweaver examines
the link in the template file (href="main.css") and creates a link in the template-based page that is relative to the location
of the new document. For example, if you are creating a template-based document one level up from the Templates
folder, Dreamweaver would write the link in the new document as href="Templates/main.css". This update in
Dreamweaver 8 broke links in pages created by those designers who had taken advantage of Dreamweaver’s former
practice of not updating links to files in the Templates folder.
Dreamweaver 8.01 added a preference that enables you to turn the update relative links behavior on and off. (This
special preference only applies to links to files in the Templates folder, not to links in general.) The default behavior is
to not update these links (as in Dreamweaver MX 2004 and before), but if you want Dreamweaver to update these kinds
of links when creating template-based pages, you can deselect the preference. (You would only do this if, for example,
you had a Cascading Style Sheets (CSS) page, main.css, in your Templates folder, and you wanted a template-based
document to contain the link href="Templates/main.css"; but this is not recommended practice as only Dreamweaver
template (DWT) files should reside in the Templates folder.)