beautypg.com

A simple data source example, Creating the data source definition file, Creating the edml file – Adobe Extending Dreamweaver CS4 User Manual

Page 298

background image

292

EXTENDING DREAMWEAVER CS4

Data sources

A simple data source example

This extension adds a custom data source to the Bindings panel for Adobe ColdFusion documents. Users can specify
the variable they want from the new data source.

This example creates a data source called MyDatasource, which includes a MyDatasource.js JavaScript file, a
MyDatasource_DataRef.edml file, and MyDatasource Variable command files to implement a dialog box for users to
enter the name of a specific variable. The MyDatasource example is based on the implementation of the Cookie
Variable data source and the URL Variable data source. The files for these data sources reside in the
Configuration/DataSources/ColdFusion folder.

You create this data source by creating a definition file, an EDML file, a JavaScript file, and supporting command files;
then you test the new data source.

Creating the data source definition file

The data source definition file tells Dreamweaver the name of the data source as it will appear in the Bindings Plus (+)
menu and also tells Dreamweaver where to find the supporting JavaScript files for the data source implementation.

When a user clicks on the Bindings Plus (+) menu, Dreamweaver searches the DataSources folder for the current
server model to gather all available data sources defined in the folder’s HTML (HTM) files. So, to make a new data
source available to the user, you need to create a data source definition file that simply provides the name of the data
source using the

title

tag and the location of all supporting JavaScript files using the

script

tag.

In addition, several supporting files are necessary for implementing this data source. In general, you might not need
to use the functions in these supporting files, but they are often useful (and necessary in this example). For example,
the dwscriptsServer.js file contains the

dwscripts.stripCFOutputTags()

function used in the implementation of

this data source. And, using the DataSourceClass.js file, you create an instance of the DataSource class to use as the
return value of the

findDynamicSources()

function.

1

Create a new blank file.

2

Enter the following:


MyDatasource






3

Save the file as MyDatasource.htm in the Configuration/DataSources/ColdFusion folder.

Creating the EDML file

The EDML file defines the code that Dreamweaver inserts into the document to represent the data source value. (For
more information about EDML files, see

Server behaviors

” on page 246). When a user adds a particular value from a

data source to a document, Dreamweaver inserts the code that will translate into the actual value at runtime. The
participant EDML file defines the code for the document (for more information, see

Participant EDML files

” on

page 265).

This manual is related to the following products: