BackFirst PageNext

Creating Tag Definitions

Various features of the development environment require the knowledge about a specific tag to operate properly. For instance the Tag Inspector feature cannot function properly unless it knows the attributes of the tag being entered. In addition, it needs to know the type of each tag attribute, and in special instances, even the enumerated values for a specific attribute. The Tag Inspector uses a set of tag definitions to learn about the specifics of various tags.

The tag definitions are stored in \Extensions\TagDefs\ under the installation directory. VTML is used to create tag definitions. For instance, all the information about the APPLET tag is stored in \Extensions\TagDefs\HTML\Applet.vtm. The definition files are organized in language directories due to name conflicts between various markup languages. Users can customize existing tag definitions, as well as create new tag definition files.

The following features use the tag definition files:

Creating a Tag Definition File

Every tag editor file contains the following markup structure:

<TAG>

    <ATTRIBUTES>

    ... Defines tag attribute properties and behavior

    </ATTRIBUTES>

    <ATTRIBCATEGORIES>

    ... Defines logical grouping for tag attributes
    </ATTRIBCATEGORIES>

    <EDITORLAYOUT>

    ... Defines the layout of a tag editor

    </EDITORLAYOUT>

    <TAGLAYOUT>

    ... Defines the tag generation template
    </TAGLAYOUT>

    <TAGDESCRIPTION>

    ... HTML-based documentation for the tag

    </TAGDESCRIPTION>

</TAG>

You can create the definition file in three ways:

Defining Attributes

The ATTRIBUTES block defines attributes inside the main TAG block. The ATTRIBUTES block can only contain ATTRIB and EVENT (see section below) tags. The following example demonstrates the definition of four tag attributes: VALUE, TITLE, ALT and ALIGN.

<ATTRIBUTES>
<ATTRIB NAME="VALUE">
<ATTRIB NAME="TITLE">
<ATTRIB NAME="ALT">
<ATTRIB NAME="ALIGN">
</ATTRIBUTES>

In most cases the features such as Tag Insight require to know more than just the names of the attribute. You can use the ATTRIB tag to define:

Defining attribute value types

The value type for a specific attribute can be specified using the TYPE attribute in the ATTRIB tag.

<ATTRIBUTES>
<ATTRIB NAME="VALUE"    TYPE="text" />
<ATTRIB NAME="BGCOLOR"  TYPE="color"/>
<ATTRIB NAME="FONTFACE" TYPE="font" />
</ATTRIBUTES>

The possible value types are:

The following value types are available in ColdFusion Studio ONLY:

Defining enumerated values

Enumerated values can be specified for attributes of TYPE="Enumerated." A subtag ATTRIBOPTION is used to specify such values:

<ATTRIB NAME="CHARSET" TYPE="ENUMERATED" >
    <ATTRIBOPTION VALUE="iso-8859-1" CAPTION="Western" />
    <ATTRIBOPTION VALUE="iso-8859-2" CAPTION="Central European (ISO)" />
    <ATTRIBOPTION VALUE="iso-8859-8" CAPTION="Hebrew (ISO-Visual)" />
</ATTRIB>

The CAPTION attribute specifies the form in which the option appears in the drop-down list box while the VALUE attribute specifies the underlying value used by the attribute. The CAPTION attribute is optional.

ATTRIB Tag Attributes
NAME Name of the attribute.
TYPE (Optional) Type of the value expected for the attribute:
  • TEXT -- free text content
  • ENUMERATED -- a list of enumerated values
  • COLOR -- a color value (name or hex)
  • FONT -- font name or font family
  • STYLE -- a CSS STYLE attribute
  • FILEPATH -- a full filepath
  • DIRECTORY -- a directory path
  • FILENAME -- filename only
  • RELATIVEPATH -- a relative representation of the path
  • FLAG -- an ON\OFF attribute containing no value
Special Types Available in ColdFusion Studio ONLY:
  • QUERYNAME -- a ColdFusion record set name
  • EXPRESSION -- a ColdFusion expression
CACHEFAMILY (Optional) The name of the cache family associated with the attribute.
CONTROL (Optional) Use to populate the attribute value to a specific tag editor control when editing existing tags.

Use the following attributes to specify enumerated values:

ATTRIBOPTION Tag Attributes
VALUE The value of the enumerated option.
CAPTION (Optional) The visual representation of the option if different from VALUE.

Defining Events

The ATTRIBUTES block can also contain definitions of supported events. The EVENT tag is used to define an even similarly to the ATTRIB tag. The following example demonstrates the definition of two events (onClick, onBlur) in addition to the attribute defined above.

<ATTRIBUTES>
<ATTRIB NAME="VALUE">
<ATTRIB NAME="TITLE">
<ATTRIB NAME="ALT">
<ATTRIB NAME="ALIGN">

<EVENT NAME="ONCLICK">
<EVENT NAME="ONBLUR">
</ATTRIBUTES>

The case (uppercase, lowercase, mixed) does not matter when defining events as all event handlers are automatically formatted by the environment based on the following rules:

  • JavaScript event handles are always formatted in mixed case are required by the language
  • All non-JS event handlers are entered in lower case

Defining Attribute Categories

Use the ATTRIBCATEGORIES section to define attribute categories. The categories are used to organize the attributes when viewed in the Tag Inspector. The ATTRIBCATEGORIES block can only contain ATTRIBGROUP tags. The following example demonstrates the definition of four categories.

<ATTRIBCATEGORIES>
    <ATTRIBGROUP NAME="Appearance"
        ELEMENTS="BACKGROUND,BGPROPERTIES,LEFTMARGIN,TOPMARGIN"/>
    <ATTRIBGROUP NAME="Colors"    
        ELEMENTS="BGCOLOR,VLINK,ALINK,LINK,TEXT"/>
    <ATTRIBGROUP NAME="Misc"
        ELEMENTS="GIZMO"/>
</ATTRIBCATEGORIES>

Use the following attributes to specify the category attributes:

ATTRIBGROUP Tag Attributes
NAME The name of the category.
ELEMENTS The list of attributes included in the category.


BackFirst PageNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.