MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Dokumentacja Strona 447

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 504
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 446
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"; //
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
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.
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 *
Przeglądanie stron 446
1 2 ... 442 443 444 445 446 447 448 449 450 451 452 ... 503 504

Komentarze do niniejszej Instrukcji

Brak uwag