beautypg.com

Chapter 21: server models, Customizing server models, The server model api functions – Adobe Extending Dreamweaver CS4 User Manual

Page 328: Canrecognizedocument(), Server models

background image

322

Chapter 21: Server models

Server models are the technologies that run scripts on a server. When users define a new site, they can identify the
server model that they want to use at the site level and at the individual document level. This server model handles any
dynamic elements that the user adds to the document.

Server model configuration files are stored in the Configuration/ServerModels folder. Within that folder, each server
model has its own HTML file that implements a set of functions that the server model requires.

Customizing server models

You can customize some features of a server model using the functions that are available in the server model API.

Adobe Dreamweaver asks new users to identify server models when they first start Dreamweaver. For cases when the
user does not identify a server model, you can create a dynamic dialog box that prompts the user to complete the
necessary steps. This dialog box appears when the user attempts to insert a server object. For information on creating
this dialog box, see the functions “

getSetupSteps()

” on page 315 and

setupStepsCompleted()

” on page 316.

You might want to create a specialized server model. Adobe suggests that you create a new server model rather than
editing any of the ones that come with Dreamweaver. (For information regarding creating new document types that
are supported by your server model, see “

Extensible document types in Dreamweaver

” on page 13.)

When you create a new server model, you need to include an implementation of the

canRecognizeDocument()

function in your server model file. This function tells Dreamweaver the level of preference that it should give to your
server model for handling a file extension when multiple server models claim a particular file extension.

The server model API functions

This section describes the functions that configure server models for Dreamweaver.

canRecognizeDocument()

Availability
Dreamweaver MX.

Description
When opening a document (and when more than one server model claims a file extension), Dreamweaver calls this
function for each of the extension-associated server models to see whether any of the functions can identify whether
the document is its file. If more than one server model claims the file extension, Dreamweaver gives priority to the
server model that returns the highest integer.

Note: All Dreamweaver-defined server models return a value of

1

, so third-party server models can override the file-

extension association.

This manual is related to the following products: