Building Tag Editors
177
Populating dialog boxes with tag data
Once the layout of controls is completed, you need to define the way in which the
editor controls are populated when you are editing an existing tag. This is done in the
attributes
block of the main tag editor template.
The
attributes
block can contain
attrib
and
event
tags. The
attrib
tag defines
the way in which tag attribute values are inserted into the dialog controls.
<attributes>
<attrib name="value" control="txtName"/>
<attrib name="title" control="txtTitle"/>
<attrib name="title" control="txtTitle2"/>
<attrib name="alt" control="txtAltText"/>
<attrib name="align" control="dropAlign"/>
</attributes>
The
name
attribute of the
attrib
tag specifies the name of the attribute, while
control
specifies which control the value of that attribute should be assigned to. You
can have multiple
attrib
tags with the same name. This is common for more
complex tag editor dialog boxes where a single attribute value may have to be filled
into multiple controls.
Special attrib tag variable names
The following special variables can be used:
•
$$TAGBODY
This special tag attribute name is used when a control needs to
be populated by the body of a tag. An example of such a tag editor is the editor for
the HTML tag
textarea
. The body of the
textarea
tag is filled into the
txtTextAreaContent
control using the following
attrib
code:
<attrib name="$$TAGBODY" control="txtTextAreaContent"/>
•
$$TAGSTRING
and
$$WHOLETAGSTRING
These attributes can be used to
populate controls with the start tag string or the whole tag including its start tag,
body and the end tag. This allows ActiveX controls to be passed to the entire tag
for custom processing and specialized tag editor behavior.
•
$$EmbeddedCodeString
Represents just the text within a tag. It excludes the
tag name, delimiters, and white space outside the text block.
Generating a tag
The final stage in the process of building a tag editor is defining how a tag gets
generated from the date entered in the editor controls. The tag generation logic is
stored in the
taglayout
block. This block contains a short template used to generate
the final tag string.
A good way to get started is to have a look at the taglayout sections of existing HTML
tag editors located in the \Extensions\TagDefs\HTML directory.
Содержание ColdFusion Server 5
Страница 18: ...xviii About This Book...
Страница 26: ...8 Chapter 1 Setting Up the Product...
Страница 42: ...24 Chapter 2 Configuring Browsers and Servers...
Страница 60: ...42 Chapter 3 Exploring the Workspace...
Страница 100: ...82 Chapter 6 Editing Pages...
Страница 126: ...108 Chapter 7 Using Web Development Languages...
Страница 212: ...194 Chapter 13 Customizing the Development Environment...
Страница 320: ...302 Glossary...