The generated include file

 < Day Day Up > 

The include file that applyConnection() generates declares all the properties of a connection.The filename for the include file is the connection name and has the file extension that is defined for the server model associated with the current site.

NOTE

Connections are shared, so set the allowMultiple value to false. This ensures that the connection file is included in the document only once and that the server script remains in the page if any other server behaviors use it.


The following sections illustrate some sample include files that applyConnection() generates for various default server models.

NOTE

To create a new connection include file format, you need to define a new EDML mapping file, which should be similar to connection_includefile.edml, as shown in "The definition file for your connection type" on page 613.


ASP JavaScript

The ASP and JavaScript include file should be named MyConnection1.asp, where MyConnection1 is the name of the connection. The following sample is an include file for an ADO connection string:

 <%   // Filename="Connection_ado_conn_string.htm"   // Type="ADO"   // HTTP="true"   // Catalog=""   // Schema=""   var MM_MyConnection1_STRING = "dsn=pubs"; %> 

The server behavior file includes this connection by using the relative file include statement, as shown in the following example:

 <!--#include file="../Connections/MyConnection1.asp"--> 

ColdFusion

When you use UltraDev 4 ColdFusion, Dreamweaver relies on a ColdFusion include file to get a list of data sources.

NOTE

For regular Dreamweaver ColdFusion, Dreamweaver ignores any include files and, instead, makes use of RDS to retrieve the list of data sources from ColdFusion.


The UltraDev 4 ColdFusion include file should be named MyConnection1.cfm, where MyConnection1 is the name of your connection. The following example shows the include file for a ColdFusion connection to a product table:

 <!-- FileName="Connection_cf_dsn.htm" "dsn=products" --> <!-- Type="ADO" --> <!-- Catalog="" --> <!-- Schema="" --> <!-- HTTP="false" --> <CFSET MM_MyConnection1_DSN       = "products"> <CFSET MM_MyConnection1_USERNAME  = ""> <CFSET MM_Product_USERNAME        = ""> <CFSET MM_MyConnection1_PASSWORD  = ""> 

The server behavior file includes this connection by using the cfinclude statement, as shown in the following example:

 <cfinclude template="Connections/MyConnection1.cfm"> 

JSP

The JSP include file should be named MyConnection1.jsp, where MyConnection1 is the name of your connection. The following example is the include file for a JDBC connection to a database:

 <%   // Filename="Connection_jdbc_conn1.htm"   // Type="JDBC"   // HTTP="false"   // Catalog=""   // Schema=""   String MM_MyConnection1_DRIVER    = "com.inet.tds.TdsDriver";   String MM_MyConnection1_USERNAME  = "testadmin";   String MM_MyConnection1_PASSWORD  = "velcro";   String MM_MyConnection1_URL       = "jdbc:server:test-   3:1433?database=pubs"; %> 

The server behavior file includes this connection by using the relative file include statement, as shown in the following example:

 <%@ include file="Connections/MyConnection1.jsp" %> 

     < Day Day Up > 


    Developing Extensions for Macromedia Dreamweaver 8
    Developing Extensions for Macromedia Dreamweaver 8
    ISBN: 0321395409
    EAN: 2147483647
    Year: 2005
    Pages: 282

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net