A Simple Block/Tag Translator Example - Adobe 38040334 - Dreamweaver CS3 User Manual

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

// Increment the counter so that the next instance
// of mmTranslatedValue will have a unique name, and
// then find the next <# conditional in the code.
count++;
start = outStr.indexOf('<# if',end);
}
// Return the translated string.
return outStr
}
function getTranslatorInfo(){
returnArray = new Array(7);
returnArray[0] = "Pound_Conditional";
returnArray[1] = "Pound Conditional Translator";
returnArray[2] = "2";
returnArray[3] = "html";
returnArray[4] = "htm";
returnArray[5] = "1";
returnArray[6] = "<#";
returnArray[7] = "byString";
returnArray[8] = "50";
return returnArray
}
</script>
</head>
<body>
</body>
</html>
3
Save the file as Poco.htm in the Configuration/Translators folder.

A simple block/tag translator example

To help understand translation, look at a translator that is written entirely in JavaScript, which does not rely on a C
library for any functionality. The following translator example would be more efficient if it were written in C, but the
JavaScript version is simpler, which makes it perfect for demonstrating how translators work.
As with most translators, this one is designed to mimic server behavior. Assume that your web server is configured
to replace the
tag with a different picture of an engineer, depending on the day of the week, the time of day, and
KENT
the user's platform. The translator does the same thing, only locally.
To create the block/tag translator:
1
Create a new blank file.
Enter the following code:
2
<html>
<head>
<title>Kent Tag Translator</title>
<meta http-equiv="Content-Type" content="text/html; charset=">
<script language="JavaScript">
// The translatorClass
// The title
// The number of extensions
// The first extension
// The second extension
// The number of expressions
// The first expression
//
//
DREAMWEAVER CS3
337
Extending Dreamweaver

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents