Specifications
Chapter 19230
The mmTranslatedValue attribute must be unique within the tag. If it is likely that your
translator needs to translate more than one attribute in a single tag, you must add a routine in the
translator that appends numbers to
mmTranslatedValue (for example, mmTranslatedValue1,
mmTranslatedValue2, and so on).
The value of the
mmTranslatedValue attribute must be a URL-encoded string that contains at
least one valid attribute/value pair. This means that
mmTranslatedValue="src=%22open.jpg%22" is a valid translation for both src="<? if
(dayType == weekday) then open.jpg else closed.jpg" ?>
and <? if (dayType ==
weekday) then src="open.jpg" else src="closed.jpg" ?>
.
mmTranslatedValue="%22open.jpg%22" is not valid for either example because it contains only
the value, not the attribute.
Translating more than one attribute at a time
The
mmTranslatedValue can contain more than one valid attribute/value pair. Consider the
following untranslated code:
<img <? if (dayType==weekday) then src="open.jpg" width="320" ¬
height="100" else
src="closed.jpg" width="100" height="320" ?> alt="We're open 24 ¬
hours a day from
12:01am Monday until 11:59pm Friday">
The following example shows how the translated markup might appear:
<img <? if (dayType==weekday) then src="open.jpg" width="320" ¬
height="100" else
src="closed.jpg" width="100" height="320" ?>
mmTranslatedValue="src=%22open.jpg%22 width=%22320%22 ¬
height=%22100%22"
alt="We're open 24 hours a day from 12:01am Monday until 11:59pm ¬
Friday">
Notice that the spaces between the attribute/value pairs in the mmTranslatedValue are not
encoded. Because Dreamweaver looks for these spaces when it attempts to render the translated
value, each attribute/value pair in the
mmTranslatedValue must be encoded separately and then
pieced back together to form the full
mmTranslatedValue. For an example of how to do this, see
“A simple attribute translator example” on page 230.
A simple attribute translator example
To better understand attribute translation, it’s helpful to look at an example. The following
translator is “Pound Conditional” (Poco) markup, a syntax that’s somewhat similar to ASP or
PHP. The first step in making this translator work properly is to create a tagspec for Poco
markup, which prevents Dreamweaver from parsing the untranslated Poco statements.
The following example shows the tagspec for Poco markup:
<tagspec tag_name="poco" start_string="<#" end_string="#>"
detect_in_attribute="true" icon="poco.gif" icon_width="17"
icon_height="15"></tagspec>