cfmodule

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

 <cfmodule>

Attribute Reference for the cfmodule tag

template

Required: No
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

Required: No
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

Required: No
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.

Examples sample code using the cfmodule tag


Using the template attribute with an absolute template path

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

Using the template attribute with a relative template path

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

Using the name attribute

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

Passing two ad-hoc attributes in tag body

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

Passing two ad-hoc attributes using the attributeCollection attribute

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

Passing content between opening and closing tags

In this example, the <p> tag and it's content will be availble 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>

Fork me on GitHub