21.1 Third-Party Tag Files
The Dreamweaver4/Configuration/ThirdPartyTags folder contains the tag
definition files that support ASP, JSP, ColdFusion and PHP tags.
(This folder also contains GIF images used as placeholder icons for
third-party tags.) The tag definition files are in XML format and can
be modified to enhance Dreamweaver's recognition of server-side
language tags.
If you are using a server-side language not supported by
Dreamweaver, you can create additional tag files that tell
Dreamweaver how to read and display third-party tags. (If creating a
new tag definition file, give it an .xml extension and place it in the
ThirdPartyTag folder.) After
creating or updating a tag definition file, restart Dreamweaver to
load the new tag definitions. To prevent Dreamweaver from rewriting
code in external files, add the third-party script's file
extension to the "Never Rewrite Code in File with
Extensions" field under Edit Preferences Code
Rewriting. See Section 18.4 in
Chapter 18 for more information. The formatting
options for third-party tags are also controlled by the SourceFormat.txt file, discussed in Section 18.3 in Chapter 18.
21.1.1 <tagspec> Elements
Each
tag definition file contains one or more
<tagspec> elements. A
<tagspec> element does not define a
third-party tag (that's up to the third-party language itself),
it just tells Dreamweaver how to interpret and display third-party
tags. See "Customizing the interpretation of third-party
tags" under Help Extending Dreamweaver for additional
guidance.
Dreamweaver can interpret two types of third-party tags:
- HTML-style tags
-
So-called normal HTML-style
tags are third-party tags that look like
typical HTML tags. HTML-style tags may use an opening and closing tag
such as
<tagname>
and
</tagname>
to enclose data (similar to matching HTML block tags such as
<p></p>). HTML-style tags can also be
empty. In
this case, similar to an HTML <img> tag,
they can contain attributes but do not surround content and do not
use a closing tag. ColdFusion uses HTML-style tags.
- String-delimited tags
-
String-delimited
tags are third-party tags that are delimited by
different characters than HTML tags. For example, ASP tags start with
<% and end with %>.
Therefore, the <tagspec> for
string-delimited tags includes the start_string
and end_string attributes to specify the
delimiters that mark the beginning and end of the tag. Dreamweaver
ignores the information between these delimiters. String-delimited
tags are similar to empty HTML-style tags (such as
<img>) because they do not surround content
and do not use a closing tag.
The valid attributes and their values within the
<tagspec> differ depending on whether the
<tagspec> element describes an HTML-style
tag or a string-delimited tag. Dreamweaver uses the attributes to
validate or parse the third-party tags (or refrain from doing so, if
instructed). The attributes are as follows:
- tag_name
-
Specifies the name for the tag. For HTML-style tags, this attribute
is the name of the tag, such as CFABORT. For
string-delimited tags, the
tag_name is used solely to determine if a
Property inspector can edit the tag. (Custom Property inspectors can
be written to display and adjust third-party tags, as described in
the "A simple Property inspector example" section under
Help Extending Dreamweaver.) A Property inspector can indicate
that it understands a tag by including its
tag_name surrounded by asterisks on its first line
of code. For example, because ASP tags use
tag_name="asp", Property inspectors that can
understand ASP tags should include *asp* on their
first line.
- tag_type
-
Specifies
whether an HTML-style tag can include contents between its opening
and closing tags ("nonempty") or is empty
("empty"). This attribute is ignored for
string-delimited tags.
- render_contents
-
Specifies whether to display the
tag's contents ("true") or a placeholder
icon ("false") in Design view. This attribute is
required if you are using tag_type="nonempty", but
is ignored for string-delimited tags.
- content_model
-
Specifies where a tag can appear in an
HTML file and what type of content it can contain. Four values are
possible:
- block_model
A tag that can contain block-level elements and appear
in the HTML document body only.
- head_model
A tag that can contain text and appear in the HTML
document head only.
- marker_model
A tag that can appear anywhere in the HTML document,
such as in the head or body section, and can contain any HTML code
this is vaild within that section.
- script_model
A tag that contains third-party script information and
can be located anywhere in the document. Dreamweaver ignores the
content of tags that use this model, such as ColdFusion tags.
- start_string
-
Specifies the starting delimiter for a
string-delimited tag, such as "<%" for ASP
tags. This attribute is required for string-delimited tags.
- end_string
-
Specifies the ending delimiter for a
string-delimited tag, such as "%>" for ASP
tags. This attribute is required for string-delimited tags.
- detect_in_attribute
-
Specifies
whether Dreamweaver ignores everything between
start_string and end_string
(for a string-delimited tag) or between opening and closing tags (for
an HTML-style tag), even inside attribute names and values. Use
true for string-delimited tags. The default is
false.
- parse_attributes
-
Specifies
whether to parse element attributes. The default is
true. Set it to false if the
element's attributes don't use the typical
name="value" format and thus cannot be parsed by
Dreamweaver. For example, the CFIF tag, which implements a logical
if statement in ColdFusion, has attributes that
aren't name/value pairs and instead look like <CFIF
x is 5>. Regardless, this option does not apply to
string-delimited tags, whose attributes are never parsed.
- icon
-
Specifies the
filename of the GIF image that serves as the placeholder icon in
Design view. (The .gif files are
typically stored in the ThirdPartyTag folder alongside the tag
definition files.)
- icon_width
-
Specifies the icon width, in pixels.
Most icons are no more than 18 pixels wide.
- icon_height
-
Specifies the icon height, in pixels.
Most icons are no more than 18 pixels
high.
21.1.2 Custom Tag Display in Design View
The tag_type
and render_contents attributes of the
<tagspec> element determine how Dreamweaver
displays third-party tags in the Document window's Design view.
If tag_type="empty" or
render_contents="false", Dreamweaver displays the
placeholder icon specified by the icon attribute
(depending on the preferences set under View Visual Aids
Invisible Elements and Edit Preferences
Invisible Elements Server Markup Tags (ASP, CFML, etc.)).
The contents of nonempty tags for which
render_contents="true" are displayed in Design
view. The content is highlighted according to the preference set
under Edit Preferences Highlighting Third-Party
Tags.
|