
384 Data Sources
To create the EDML file:
1. Create a new blank file.
2. Enter the following:
<participant>
<quickSearch><![CDATA[#]]></quickSearch>
<insertText
location="replaceSelection"><![CDATA[<cfoutput>#MyDatasource.@@bindin
gName@@#</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
MyDatasource_Variable
command used in the
addDynamicSource() function is defined in “Creating the supporting
command files for user input” on page 387.)
To create the JavaScript file:
1. Create a new blank file.
2. Enter the following:
//************** GLOBALS VARS *****************
var MyDatasource_FILENAME = "REQ_D.gif";
var DATASOURCELEAF_FILENAME = "DSL_D.gif";
//****************** API **********************
function addDynamicSource()
{
MM.retVal = "";
MM.MyDatasourceContents = "";
dw.popupCommand("MyDatasource_Variable");
if (MM.retVal == "OK")
Commentaires sur ces manuels