Customizing the interpretation and appearance of third-party tags

Server-side processing technologies such as ASP, PHP, ColdFusion, and JSP use special non-HTML code in HTML files; servers create and serve HTML content based on that code. When Dreamweaver encounters non-HTML tags, it compares them with information in its third-party tag files, which define how Dreamweaver reads and displays non-HTML tags.

For example, ASP (Active Server Pages) files contain code for the server to interpret. This code is set off by a pair of delimiters: it begins with the string <% and ends with the string %>. Dreamweaver's Configuration/ThirdPartyTags folder contains a file named ASP.xml, which describes the format of ASP code and defines how Dreamweaver displays that code. Because of the way ASP code is specified in ASP.xml, Dreamweaver doesn't try to interpret anything between the starting and ending delimiters.

You can define your own tags and create tag database files to define how Dreamweaver reads and displays them. Creating tag database files is particularly useful if you're using a server-side markup system other than ASP, ColdFusion, or PHP; create a new tag database file for each such markup system, to tell Dreamweaver how to display the tags.

Note: This section explains how to define the appearance of a custom tag within Dreamweaver, but not how to edit the content or properties of a custom tag. For information on how to create a Property inspector to inspect and change the properties of a custom tag, see "Property Inspectors" in Extending Dreamweaver.

Each tag database file defines the name, type, content model, rendering scheme, and icon for one or more custom tags. You can create any number of tag database files, but all of them must reside in the Configuration/ThirdPartyTags folder to be read and processed by Dreamweaver. Tag database files have the file extension .xml.

If you are working on several different unrelated sites at once (for example, as a freelance developer), put all the tag specifications for a particular site in one file. Then simply include that tag database file with the custom icons and Property inspectors that you hand over to the people who will maintain the site.

You define a tag specification with an XML tag called TAGSPEC; for example, the following code describes the specification for the HAPPY tag:

<TAGSPEC TAG_NAME="happy" TAG_TYPE="nonempty" RENDER_CONTENTS="false"
CONTENT_MODEL="marker_model" ICON="happy.gif" ICON_WIDTH="18"
ICON_HEIGHT="18"></TAGSPEC>

There are two different kinds of tags defined using TAGSPEC: normal HTML-style tags, and string-delimited tags, which start with one string and end with another string. String-delimited tags are like empty HTML tags (such as IMG) in that they don't surround content and don't have closing tags. The HAPPY tag shown above is a normal HTML-style tag; it starts with an opening <HAPPY> tag, surrounds content, and ends with a closing </HAPPY> tag. An ASP tag, which starts with the string <% and ends with the string %>, is a string-delimited tag.

The following table describes TAGSPEC's attributes and their possible values:
Attribute Value Description

TAG_NAME

tagName

The name of the custom tag. Required. (For string-delimited tags, TAG_NAME is used only to determine whether a given Property inspector can be used for the tag. If the first line of the Property inspector contains this tag name with an asterisk on each side, then the inspector can be used for tags of this type. For example, the TAG_NAME for ASP code is ASP; Property inspectors that can examine ASP code should have *ASP* on the first line. For information on the Property inspector API, see "Property Inspectors" in Extending Dreamweaver.)

TAG_TYPE*

empty or nonempty

Determines whether the tag itself is the content (as with IMG), or whether it surrounds content (as with CODE). Required for normal (non-string-delimited) tags.

RENDER_CONTENTS*

TRUE or FALSE

Determines whether the contents of the tag should appear in the document window, or whether the icon appears instead. Required for nonempty tags. Applies only to tags that appear outside of attributes.

CONTENT_MODEL*

block_model, head_model, marker_model, or script_model

Describes both what content the tag can contain and what the tag can be contained by. Required.

block_model specifies that the tag can contain block-level elements such as DIV and P, and that the tag can appear only in the BODY section or inside other body-content tags such as DIV, LAYER, or TD.

head_model specifies that the tag can contain text content, and that it can appear only in the HEAD section.

marker_model specifies that the tag can contain any valid HTML code, and that it can appear anywhere. (Because adding text outside of a valid HEAD element creates invalid HTML, you must use head_model instead of marker_model if you want to place a custom tag containing text in the HEAD section.)

Use marker_model for tags that should be displayed inline (inside a block-level element such as P or DIV) rather than causing a line break.

script_model allows the tag to exist anywhere between the opening and closing HTML tags of a document. When Dreamweaver encounters a tag with this model, it ignores all of the tag's content. Used for third-party markup (like certain ColdFusion tags) that Dreamweaver shouldn't parse.

START_STRING

beginningOfTag

Specifies a delimiter that marks the beginning of a string-delimited tag. String-delimited tags can appear anywhere in the document where a comment can appear. Dreamweaver performs no tag parsing and no entity or URL decoding between START_STRING and END_STRING. Required if END_STRING is specified.

END_STRING

endOfTag

Specifies a delimiter that marks the end of a string-delimited tag. Required if START_STRING is specified.

DETECT_IN_ATTRIBUTE

TRUE or FALSE

Indicates whether to ignore everything between START_STRING and END_STRING (or between opening and closing tags if those strings aren't defined) even when those strings appear inside attribute names or values. You should generally set this to TRUE for string-delimited tags; the default is FALSE.

PARSE_ATTRIBUTES*

TRUE or FALSE

Indicates whether to parse the attributes of the tag. If this is set to TRUE (the default), Dreamweaver parses the attributes; if it's set to FALSE, Dreamweaver ignores everything until the next closing angle bracket that appears outside of quotation marks. For example, this attribute should be set to FALSE for a tag like CFIF (as in <cfif a is 1>).

ICON

URL

Specifies the path and file name of the icon associated with the tag. Required for empty tags, and for nonempty tags whose contents are not displayed in the Document window.

ICON_WIDTH

widthInPixels

Specifies the width of the icon.

ICON_HEIGHT

heightInPixels

Specifies the height of the icon.

* Ignored for tags that use START_STRING and END_STRING.