Specifications

251
CHAPTER 21
C-Level Extensibility
The C-level extensibility mechanism lets you implement Macromedia Dreamweaver MX
extensibility files using a combination of JavaScript and your own C code. You define functions
using C, bundle them in a DLL or shared library, save the library in the Configuration/
JSExtensions folder within the Dreamweaver application folder, and then call the functions from
JavaScript using the JavaScript interpreter that is built into Dreamweaver.
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
for file I/O, you must write a function in C to provide this functionality.
You can use the following HTML and JavaScript to create a simple Insert Text from File object.
Notice that the
objectTag() function calls a C function named readContentsOfFile(), 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>