Adobe Extending Dreamweaver CS4 Instrukcja Użytkownika Strona 353

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 387
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 352
347
Chapter 23: C-level extensibility
The C-level extensibility mechanism lets you implement Adobe Dreamweaver extensibility files using a combination
of JavaScript and custom C code. You define functions using C, bundle them in a dynamic linked library (DLL) or a
shared library, save the library in the Configuration/JSExtensions folder within the Dreamweaver application folder,
and then call the functions from JavaScript using the Dreamweaver JavaScript interpreter.
For example, you might want to define a Dreamweaver object that inserts the contents of a user-specified file into the
current document. Because client-side JavaScript does not provide support file input/output (I/O), you must write a
function in C to provide this functionality.
How integrating C functions works
You can use the following HTML and JavaScript to create a simple Insert Text from File object. The objectTag()
function calls the
readContentsOfFile() C function, which is stored in a library named myLibrary.
<HTML>
<HEAD>
<SCRIPT>
function objectTag() {
fileName = document.forms[0].myFile.value;
return myLibrary.readContentsOfFile(fileName);
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
Enter the name of the file to be inserted:
<INPUT TYPE="file" NAME="myFile">
</FORM>
</BODY>
</HTML>
The readContentsOfFile() function accepts a list of arguments from the user, retrieves the filename argument,
reads the contents of the file, and returns the contents of the file. For more information about the JavaScript data
structures and functions that appear in the
readContentsOfFile() function, see “C-level extensibility and the
JavaScript interpreter” on page 349.
Przeglądanie stron 352
1 2 ... 348 349 350 351 352 353 354 355 356 357 358 ... 386 387

Komentarze do niniejszej Instrukcji

Brak uwag