• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How do I call a function from the other CFC

Explorer ,
Oct 10, 2012 Oct 10, 2012

Copy link to clipboard

Copied

Hi,

Is there the way to call the function from other cfc?

From cfc.message, how can i call the method "getuser" from user.cfc

<cfcomponent name="user">

    <cffunction name="getuser">

    </cffunction>

</cfcomponent>

<cfcomponent name="message">

    <cffunction name="get_message">

    </cffunction>

</cfcomponent>

Thanks

TOPICS
Advanced techniques

Views

571

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 10, 2012 Oct 10, 2012

Copy link to clipboard

Copied

Do it the same way you would call it from a .cfm file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 13, 2012 Oct 13, 2012

Copy link to clipboard

Copied

LATEST

Strictly speaking, you don't call a function except you're inside the CFC containing the function. From elsewhere, you have to call the function on an object. Hence, first create an instance of the CFC, then call the function on that object.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation