Creating the data source definition file
First, 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
and the location of all supporting JavaScript files using the
For a data source called MyDatasource (and with a supporting JavaScript file MyDatasource.js to
be created later), write the following data source definition file:
<HTML>
<HEAD>
<TITLE>MyDatasource</TITLE>
<SCRIPT SRC="../../Shared/Common/Scripts/dwscripts.js"></SCRIPT>
<SCRIPT SRC="../../Shared/Common/Scripts/dwscriptsServer.js"></SCRIPT>
<SCRIPT SRC="../../Shared/Common/Scripts/DataSourceClass.js"></SCRIPT>
<SCRIPT SRC="MyDatasource.js"></SCRIPT>
</HEAD>
<body></body>
</HTML>
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()
And, using the DataSourceClass.js file, we will create an instance of the DataSource class to use as
the return value of the
Next, save this definition file in the Configuration\DataSources\ColdFusion folder as
MyDatasource.htm.
Creating the EDML file
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
For the MyDatasource Variable, you want Dreamweaver to insert the ColdFusion code
<cfoutput>#MyXML.variable#</cfoutput>
the data source.
Create a file with the following content:
<participant>
<quickSearch><![CDATA[#]]></quickSearch>
<insertText
location="replaceSelection"><![CDATA[<cfoutput>#MyDatasource.@@bindingName@
@#</cfoutput>]]></insertText>
<searchPatterns whereToSearch="tag+cfoutput">
<searchPattern paramNames="sourceName,bindingName"><![CDATA[/
#(?:\s*\w+\s*\()?(MyDatasource)\.(\w+)\b[^#]*#/i]]></searchPattern>
</searchPatterns>
</participant>
Save the file in the Configuration\DataSources\ColdFusion folder as
MyDatasource_DataRef.edml.
300
Chapter 16: Data Sources
function used in the implementation of this data source.
findDynamicSources()
tag.
SCRIPT
function.
"Participant EDML files" on page
where
is the value the user wants from
variable
tag
TITLE
268).
Need help?
Do you have a question about the DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER and is the answer not in the manual?