Tag Usage
Allaire Spectra consists of more than 400 custom tags. Spectra tags are designated by the prefix cfa_, unlike standard CFML custom tags, which are prefixed by cf_. This avoids naming conflicts with any custom tags that you may use in your applications. Just like standard CFML, Spectra tags have attributes and may or may not require end tags. Always refer to the tag help or Appendix A, "Allaire Spectra Tags," if you are unsure.
TIP
When you choose to install the client tools, help files and tag insight scripts are installed into ColdFusion Studio. The complete Allaire Spectra documentation set is then accessible from the Help tab.
Naming
To reduce confusion, Spectra tags are named by using the formula object-action. This means that if you need a tag to retrieve a ContentObject, the most likely name would be cfa_ContentObjectGet. Similarly, if you needed to copy a ContentObject to another ContentObject as an embedded object (which you'll learn about later in this chapter), you would use cfa_ContentObjectCreateEmbeddedFromOriginal (object-action-object-action).
Attributes
Spectra tags expect two kinds of attributes: input and output. Input attributes are further divided into data types for efficient processing. Characters that denote what data type the attribute will accept prefix each attribute name. Table 3.1 shows these attribute prefixes and what these tags will validate.
Table 3.1 Attribute Prefixes
Prefix |
Example |
Expected Result |
a |
aObjects |
Array |
st |
stProperties |
Structure or associative array |
n |
nValue |
Number or float |
i |
iMaxItems |
Integer |
o |
oProfile |
Object. Since objects exist as structures in Spectra, this isn't used. |
dt |
dtLastModified |
Date or date-time |
(none) |
|
String |
w |
wstProperties |
In combination with any other prefix, this means a WDDX packet of the data type indicated by the secondary prefix is expected. |
r_ |
r_result |
Variable name. This is similar to the NAME attribute in CFML tags such as CFQUERY. The result of the tag execution will be placed in the specified variable. |
CAUTION
The Spectra tag naming conventions are generally followed, but there are exceptions to the rule. Be sure to refer to documentation or use the appropriate Studio Tag Editors; don't make any assumptions about naming conventions.
Encapsulation
Just like other CFML tags, Spectra tags can be encapsulated inside your own custom tags. Typically, you would encapsulate Spectra tags to provide clearer meaning to what these tags are supposed to do in specific circumstances. For instance, the Spectra tag <cfa_container> allows you to create a container. If you want to refer to a specific container that contains news items, you would use the attribute containerID. The following shows how you could encapsulate the <cfa_container> tag in your own custom tag, <cf_news>:
<!--- Call the container by ID to preserve settings ---> <cfa_container containerID="F345D34-4763-DC8788B2A980" >
A site designer could intuitively use this in a document without looking for the actual container ID.