coldfusioncustom-tags

ColdFusion Using Custom Tags Within Custom Tags


I'm a bit new to ColdFusion (coming from Java/OOP world)

I have a custom tag that runs some things inside a cfscript and outputs a value. I'd like to have this custom tag (let's call it A) call another custom tag (let's call it B, a more general custom tag that has a sort of 'static' function) with a certain parameter.

How do I call B from within A? How do I use the return value from B in A?

A's code

<cfscript>
     //Call to other custom tag here?:
     //foo = [CUSTOMTAG param="stuff"];
     value = foo;
</cfscript>
<cfoutput>#value#</cfoutput>

Solution

  • Here's what I ended up doing. In my "A" file (recall, A calls B):

    <cfscript>
    b = createObject("component","bName");
    returnVal = b.method("paramInfo");
    </cfscript>
    

    In my "B" file

    <cfcomponent displayname="bName">
    <cffunction name="method" returntype="string" output="false">
    <cfargument name="paramName" required="yes" type="string">
    <cfscript>
     returnVal = paramName;
    </cfscript>
    <cfreturn returnVal>
    </cffunction>
    </cfcomponent>