beautypg.com

Template parameters, Template expressions – Adobe Dreamweaver CC 2014 v.13 User Manual

Page 512

background image

To the top

To the top

To the top

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.)

To have Dreamweaver update document-relative paths to non-template files in the Templates folder, select the Templates category in the Site
Setup dialog box (it’s under Advanced Settings), and deselect the Don’t Rewrite Document Relative Paths option.

For more information, see the Dreamweaver TechNote on the Adobe website at

www.adobe.com/go/f55d8739

.

Server scripts in templates and template-based documents

Some server scripts are inserted at the very beginning or end of the document (before the tag or after the tag). Such scripts require
special treatment in templates and template-based documents. Normally, if you make changes to script code before the tag or after the
tag in a template, the changes are not copied to documents based on that template. This can cause server errors if other server scripts,
within the main body of the template, depended on the scripts that are not copied. An alert warns you if you change scripts before the tag
or after the tag in a template.

To avoid this problem, you can insert the following code in the head section of the template:

When this code is in a template, changes to scripts before the tag or after the tag are copied to documents based on that template.
However, you will no longer be able to edit those scripts in documents based on the template. Thus, you can choose to either edit these scripts in
the template, or in documents based on the template, but not both.

Template parameters

Template parameters indicate values for controlling content in documents based on a template. Use template parameters for optional regions or
editable tag attributes, or to set values you want to pass to an attached document. For each parameter, you select a name, a data type, and a
default value. Each parameter must have a unique name that is case sensitive. They must be one of five permitted data types: text, boolean,
color, URL, or number.

Template parameters are passed to the document as instance parameters. In most cases, a template user can edit the parameter’s default value
to customize what appears in a template-based document. In other cases, the template author might determine what appears in the document,
based on the value of a template expression.

Template expressions

Template expressions are statements that compute or evaluate a value.

You can use an expression to store a value and display it in a document. For example, an expression can be as simple as the value of a
parameter, such as @@(Param)@@, or complex enough to compute values which alternate the background color in a table row, such as
@@((_index & 1) ? red : blue)@@.

505

This manual is related to the following products: