Macromedia dreamweaver 8-extending dreamweaver User Manual
A simple block/tag translator example
447
returnArray[0] = "Pound_Conditional"; // The translatorClass
returnArray[1] = "Pound Conditional Translator"; // The title
returnArray[2] = "2"; // The number of extensions
returnArray[3] = "html"; // The first extension
returnArray[4] = "htm"; // The second extension
returnArray[5] = "1"; // The number of expressions
returnArray[6] = "<#"; // The first expression
returnArray[7] = "byString"; //
returnArray[8] = "50"; //
returnArray[1] = "Pound Conditional Translator"; // The title
returnArray[2] = "2"; // The number of extensions
returnArray[3] = "html"; // The first extension
returnArray[4] = "htm"; // The second extension
returnArray[5] = "1"; // The number of expressions
returnArray[6] = "<#"; // The first expression
returnArray[7] = "byString"; //
returnArray[8] = "50"; //
return returnArray
}
}
</script>
</head>
</head>
<body>
</body>
</html>
</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.
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
server is configured to replace the
KENT
tag with a different picture of an engineer, depending
on the day of the week, the time of day, and the user’s platform. The translator does the same
thing, only locally.
thing, only locally.
To create the block/tag translator:
1.
Create a new blank file.
2.
Enter the following code:
<html>
<head>
<title>Kent Tag Translator</title>
<meta http-equiv="Content-Type" content="text/html; charset=">
<script language="JavaScript">
/**********************************************************
* The getTranslatorInfo() function provides information *
* about the translator, including its class and name, *
* the types of documents that are likely to contain the *
<head>
<title>Kent Tag Translator</title>
<meta http-equiv="Content-Type" content="text/html; charset=">
<script language="JavaScript">
/**********************************************************
* The getTranslatorInfo() function provides information *
* about the translator, including its class and name, *
* the types of documents that are likely to contain the *