Getfileextensions(), Getlanguagesignatures() – Adobe Extending Dreamweaver CS4 User Manual

Page 329

Advertising
background image

323

EXTENDING DREAMWEAVER CS4

Server models

Arguments
dom

The dom argument is the Adobe document object, which is returned by the

dreamweaver.getDocumentDOM()

function.

Returns
Dreamweaver expects an integer that indicates the priority that you give to the server model for the file extension. This
function should return a value of

-1

if the server model does not claim the file extension; otherwise, this function

should return a value greater than zero.

Example
In the following example, if the user opens a JavaScript document for the current server model, the sample code returns
a value of

2

. This value lets the current server model take precedence over the Dreamweaver default server model.

var retVal = -1;

var langRE = /@\s*language\s*=\s*(\"|\')?javascript(\"|\')?/i;
// Search for the string language="javascript"
var oHTML = dom.documentElement.outerHTML;
if (oHTML.search(langRE) > -1)

retVal = 2;

return retVal;

getFileExtensions()

Availability
Dreamweaver UltraDev 1, deprecated in Dreamweaver MX.

Description
Returns the document file extensions with which a server model can work. For example, the ASP server model
supports .asp and .htm file extensions. This function returns an array of strings, and Dreamweaver uses these strings
to populate the Default Page Extension list that is found in the App Server category in the Site Definition dialog box.

Note: The Default Page Extension list exists only in Dreamweaver 4 and earlier. For Dreamweaver MX, and later, the
Site Definition dialog box does not list file extension settings. Instead, Dreamweaver reads the Extensions.txt file and
parses the element in the mmDocumentTypes.xml file. (For more information on these two files and the

documenttype

element, see

Extensible document types in Dreamweaver

” on page

13.)

Arguments
None.

Returns
Dreamweaver expects an array of strings that represent the allowed file extensions.

getLanguageSignatures()

Availability
Dreamweaver MX.

Advertising
This manual is related to the following products: