Macromedia dreamweaver 8-extending dreamweaver 사용자 설명서
Adding a translated attribute to a tag
435
Determining what kind of translator
to use
to use
All translators must contain the
getTranslatorInfo()
and
translateMarkup()
functions,
and they must reside in the Configuration/Translators folder. They differ, however, in the
kind of code that they insert into the user’s document and in how that code must be
inspected, as described in the following list:
kind of code that they insert into the user’s document and in how that code must be
inspected, as described in the following list:
■
To translate small pieces of server markup that determine attribute values or that
conditionally add attributes to a standard HTML tag, write an attribute translator.
Standard HTML tags that contain translated attributes can be inspected with the Property
inspectors that are built into Dreamweaver. It is not necessary to write a custom Property
inspector (see
conditionally add attributes to a standard HTML tag, write an attribute translator.
Standard HTML tags that contain translated attributes can be inspected with the Property
inspectors that are built into Dreamweaver. It is not necessary to write a custom Property
inspector (see
).
■
To translate an entire tag (for example, a server-side include) or a block of code (for
example, JavaScript, ColdFusion, PHP, or other scripting), write a block/tag translator.
The code that is generated by a block/tag translator cannot be inspected with the Property
inspectors that are built into Dreamweaver. You must write a custom Property inspector
for the translated content if you want users to be able to change the properties of the
original code (see
example, JavaScript, ColdFusion, PHP, or other scripting), write a block/tag translator.
The code that is generated by a block/tag translator cannot be inspected with the Property
inspectors that are built into Dreamweaver. You must write a custom Property inspector
for the translated content if you want users to be able to change the properties of the
original code (see
Adding a translated attribute to a tag
Attribute translation relies on the Dreamweaver parser to ignore server markup. By default,
Dreamweaver already ignores the most common kinds of server markup (including ASP,
CFML, and PHP); if you use server markup that has different opening and closing markers,
you must modify the third-party tag database to ensure that your translator works properly.
For more information on modifying the third-party tag database, see “Customizing
Dreamweaver” in Using Dreamweaver.
Dreamweaver already ignores the most common kinds of server markup (including ASP,
CFML, and PHP); if you use server markup that has different opening and closing markers,
you must modify the third-party tag database to ensure that your translator works properly.
For more information on modifying the third-party tag database, see “Customizing
Dreamweaver” in Using Dreamweaver.
When Dreamweaver handles preserving the original server markup, the translator generates a
valid attribute value that can be viewed in the Document window. (If you use server markup
only for attributes that do not have a user-visible effect, you do not need a translator.)
valid attribute value that can be viewed in the Document window. (If you use server markup
only for attributes that do not have a user-visible effect, you do not need a translator.)
The translator creates an attribute value that has a visible effect in the Document window by
adding a special attribute,
adding a special attribute,
mmTranslatedValue
, to the tag that contains the server markup.
The
mmTranslatedValue
attribute and its value are not visible in the HTML panel or in
Code view, nor are they saved with the document.