cfmodule

Invokes a custom tag for use in CFML application pages.
This tag processes custom tag name conflicts.

  <cfmodule>

 cfmodule(template="nameoftemplate.cfm",attributeCollection={});

Attribute Reference

template string

Mutually exclusive with the name attribute. A path to the
page that implements the tag.

Relative path: expanded from the current page
Absolute path: expanded using CFML mapping
A physical path is not valid.

name string

Mutually exclusive with the template attribute. A custom
tag name, in the form "Name.Name.Name..." Identifies
subdirectory, under the CFML tag root directory,
that contains custom tag page.
For example (Windows format):

cfmodule name = "superduper.Forums40.GetUserOptions"

This identifies the page GetUserOptions.cfm in the
directory CustomTags\superduper\Forums40 under the
CFML root directory.

attributecollection struct

A collection of key-value pairs that represent
attribute names and values. You can specify multiple
key-value pairs. You can specify this attribute only
once.

Compatibility

ColdFusion:

Version 3+ ColdFusion supports the cfmodule() script syntax

Lucee:

Lucee Supports script syntax module template="file.cfm"

Examples
Sample code using the cfmodule tag

<cfmodule template="\layout\default\mainheader.cfm">

<cfmodule template="..\..\..\layout\register\sectionheader.cfm">

<cfmodule name="layout.corp.copyright">

<cfmodule template="\layout\default\mainheader.cfm" theme="default" pageTitle="Welcome!">

<cfset attrs = {theme = "default", pageTitle = "Welcome!"}>
<cfmodule template="\layout\default\mainheader.cfm" attributecollection="#attrs#">

In this example, the <p> tag and it's content will be available to super-duper-formatter.cfm to perform whatever the formatting logic dictates.

<cfmodule template="\layout\super-duper-formater.cfm">
   <p>Some content the module will format</p>
</cfmodule>

In this example, show how to invoke using cfscript.

<cfscript>attrs = {theme = "default", pageTitle = "Welcome!"}>
cfmodule(template="myTemplate.cfm",attributeCollection="#attrCollection1#")</cfscript>

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub