Adobe 38040334 - Dreamweaver CS3 User Manual page 295

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

To create the data source definition file:
1
Create a new blank file.
Enter the following:
2
<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>
Save the file as MyDatasource.htm in the Configuration/DataSources/ColdFusion folder.
3
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 243). 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 262).
For the MyDatasource Variable, you want Dreamweaver to insert the ColdFusion code
<cfoutput>#MyXML.variable#</cfoutput>
To create the EDML file:
Create a new blank file.
1
2
Enter the following:
<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>
3
Save the file as MyDatasource_DataRef.edml in the Configuration/DataSources/ColdFusion folder.
Creating the JavaScript file that implements the Data Sources API functions
After you have defined the name of the data source, the name of the supporting script files, and the code for the
working Dreamweaver document, you need to specify the JavaScript functions for Dreamweaver to provide the user
with the ability to add, insert, and delete the necessary code into a document.
Based on the construction of the Cookie Variable data source, you can implement the MyXML data source, as shown
in the following example. (The
defined in "Creating the supporting command files for user input" on page 292.)
where
variable
_
MyDatasource
Variable
is the value the user wants from the data source.
command used in the
addDynamicSource()
DREAMWEAVER CS3
289
Extending Dreamweaver
function is

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents