Accessibility
 
Home / Products / UltraDev / Support / Adding Dynamic Content
Dreamweaver UltraDev Icon Macromedia Dreamweaver UltraDev Support Center - Customizing Dreamweaver UltraDev
Working with the <cfmodule> tag

You use the <cfmodule> tag like any other ColdFusion tag. After you insert it in a page's code and run the page, ColdFusion reads and executes the tag before sending the page to the user's browser.

The <cfmodule> tag takes an attribute called template or name, plus any number of parameter attributes. The template attribute specifies the relative path of the tag file (the file containing the code to be executed when the server encounters the tag). For example, if you place the tag file ExchRateCalculator.cfm in a subfolder called tags, you would insert the following <cfmodule> tag in the calling page's HTML:

<cfmodule template="tags\ExchRateCalculator.cfm">

Alternatively, if you place the tag file in the CustomTags folder in the default ColdFusion folder (Cfusion), use the name attribute instead of the template attribute and specify the file's location using dotted notation. For example, if you place the tag file ExchRateCalculator.cfm in the Cfusion/CustomTags/MyTags/Calculators folder on the server, then you would specify the tag's location as follows:

<cfmodule name="MyTags.Calculators.ExchRateCalculator">

Note: You don't have to specify the tag file's cfm extension.

If you want to pass parameters to the tag file, simply make up tag attributes for them. For example, suppose you want to pass a parameter called price and another parameter called exchange to the tag file. You could express the <cfmodule> tag as follows:

<cfmodule template="tags\ExchRateCalculator.cfm" 
	price="10300"
	exchange="YEN">

You can use ColdFusion variables—including URL and form variables—to fill in the attribute values. For example, the <cfmodule> tag could look as follows:

<cfmodule template="tags\ExchRateCalculator.cfm"
	price="#url.retailPrice#" 
	exchange="#url.exchangeRate#"> 

In the tag file, you retrieve the attribute values by using the ColdFusion attributes variable. In the above example, the expression attributes.price would retrieve the value of the price attribute, while attributes.exchange would retrieve the value of the exchange attribute. The next section describes how to write the tag file and retrieve attribute values.

To Table of Contents Back to Previous document Forward to next document