Spec-Zone.ru › ColdFusion

cfmodule

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

<cfmodule>

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

  • CF3+
  • Lucee
  • BL 1.0.0+
  • See Also: cfassociate

    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"

    BoxLang:

    Version 1.0.0+ <bx:module> in BoxLang

    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 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>

    Using cfscript with attribute collection

    In this example, show how to invoke using cfscript.

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

    © 2012–present Foundeo, Inc. and the CFDocs contributors.
    Licensed under the MIT License.
    ColdFusion is a trademark of Adobe Systems Incorporated.
    https://cfdocs.org/cfmodule

    Spec-Zone.ru

    Настройки Оффлайн Что нового Помощь О нас
    Spec-Zone .ru
    спецификации, руководства, описания, API