Share via


Working with a Component Template File

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The template file is an HTML document containing type information about each component attribute and its initial state. Each parameter is classified as one of the basic types: Boolean, Integer, String, Date, URL, or Color. In addition, Integer and String parameters can be given MIN and MAX ranges (which apply to a String's length), and a String parameter can be specified as a RADIO choice, which allows users to select one choice from among multiple choices. It specifies this information using the Microsoft FrontPage Bot Template Language (BTL), which is the same format FrontPage uses to store the persistent state of a component when it's inserted on a page.

This information allows the generic FrontPage Component Properties dialog box to display type-appropriate editing controls for each attribute. The component template files are downloaded by FrontPage only when needed, such as the first time a component of a given type is inserted into a page.

Note  The component template file is an optional file. Use it only if you set the clientbinding parameter in the component description file equal to BTL (clientbinding=BTL). (For more information on the clientbinding key setting, see Working with a Component Description File.) If omitted, you must put the expanded HTML content for the components Expand method inside the implementation file. (For more information, see Working with a Component Implementation File.)

Bot Template Language

You use the BTL in the component template file of a FrontPage component to specify the name, type, and initial state of the component attributes. This information is inserted into a page's HTML when you insert a component into a page.

The following example shows a FrontPage component referred to in the BTL.

  <!--WEBBOT BOT=SampleBot S-PARAM1="This is a string" -->

Syntax

FrontPage component templates and instances stored in the BTL are legal HTML comments. They begin with the string <!--WEBBOT and end with the string -->. No white space is allowed between the opening <!-- and WEBBOT, which must be all upper case. There must be at least one white space character before the closing -->. HTML allows white space between the final -- and the >, but BTL does not.

Between the delimiters are one or more space-separated attributes, which have essentially the same syntax as the attributes of an HTML tag. The attributes are name/value pairs with an equal sign between the name and the value. White space is allowed around the equal sign. The name begins with a letter and is followed by up to 71 letters, digits, periods, or hyphens. The name is case-insensitive. The value may be either a string literal enclosed in double quotes or a name token (with a leading digit allowed). Some attributes may consist of a name only with the equal sign and value omitted.

String literals may not contain double-quote, ampersand, or greater-than characters, but they may include newline characters. To include a quote, ampersand, or greater-than character in a string literal, escape it using HTML syntax: For example:

  "You must escape the &quot; &amp; and &gt; characters"

The first attribute of a component must be BOT=shortname. The shortname is case insensitive and may be written in mixed case for readability.  As such, SAMPLEBOT, SampleBot, and samplebot refer to the same component.

Repeated attributes with the same name but different values are allowed; this is how components store arrays of values. For example:

  <--WEBBOT BOT=ClickImage RECT="10,10,50,20" RECT="10,30,50,20" -->

Components are not allowed inside an HTML tag (for example, as the value of an HREF attribute), but otherwise components are allowed anywhere in the HTML stream that the text returned by the component evaluate method would be allowed.

HTML comments (and thus components) do not generate any white space when processed. Therefore, some<!--WEBBOT BOT=NoOpBot -->thing will be displayed as something by the editor or a browser.

Reserved Attributes

Certain reserved attributes have special meanings that are understood by the generic FrontPage Component Properties dialog box. These reserved attributes are not required, but if present must be used as described below. Other attributes have a leading character and a dash in their name to indicate their data type. This information is used by the generic FrontPage Component Properties dialog box to display type-appropriate controls for modifying the attribute value.

The following table summarizes the reserved BTL attributes and what they mean:

Attribute Meaning
NAME A short user-readable name for the component type. Often just the short name with spaces, that is: BOT=TextSearch NAME="Text Search".

The NAME attribute is optional and defaults to the short name if omitted.
 

TAG The HTML tag type returned by the Evaluate method of the component. The value should be a valid HTML tag (with no < or >; example: TAG=h4). If the TAG attribute is omitted, the component evaluates to plain text with no embedded HTML tags.
 
PREVIEW

A string, possibly containing HTML tags, which FrontPage uses to represent the component during design time. If it's missing (and the component is unknown), FrontPage displays the component name within a pair of square brackets, like:

  [WebBotName]

If a TAG attribute is provided, then the PREVIEW string must match the tag type. For example, if TAG=H2, then a valid PREVIEW string would be something like:

  "<H2>Test Component</H2>."

If the PREVIEW string contains embedded less than, greater than, ampersand, and quote characters, these must be properly escaped. The previous example would be stored in the template file as:

  PREVIEW="<H2>Test Component</H2>".
DESCR A short (one or two sentences at most) description of what the component is and does. This is displayed by the generic FrontPage Component Properties dialog box. Extra white space and new lines are removed from the description string before it's shown to the user.
 
HELP A slightly longer (a paragraph or two at most) description that is displayed when the user clicks the Help button in the generic FrontPage Component Properties dialog box. Extra white space and newline characters are removed from the help string before being shown to the user. To force a new line, put \n in the string. Use \\ for a single back-slash.

Data Type Encoding

Component attributes that users can edit should begin with a letter that specifies the data type of the attribute's value, followed by a dash. For example, an integer named Count would be represented as "I-Count=23."

The main data types supported by the generic FrontPage Component Properties dialog box are as follows:

Code Data Type
I Integer
S String
B Boolean (TRUE or FALSE)
D Date (in RFC-1123 format)
U URL (a reference to a document in the same Web)
C Color (in HTML hexadecimal format: "#ff00ff")

When attribute names are displayed to the user, the leading datatype letter and dash are removed, and dashes are converted to spaces. For example, I-Maximum-Matches becomes "Maximum Matches."

There are three additional attribute name prefixes that change the way a value is modified with the generic FrontPage Component Properties dialog box: MIN-, MAX-, and RADIO-.

The prefixes MIN- and MAX- allow the component to specify a range of legal values for integer attributes, and a minimum and maximum length for string attributes. For example, the component could contain:

  I-COUNT=10 MIN-COUNT=0 MAX-COUNT=255

The prefix RADIO- allows the component to specify that a parameter represents a one-of-many choice. Each subsequent RADIO- modifier supplies another legal value for that parameter. For example:

  S-FLAVOR="Vanilla" RADIO-FLAVOR="Vanilla" RADIO-FLAVOR="Chocolate"

Any other attributes that encode the persistent state of the component but are not user-editable must not have a dash anywhere in their name.